If all the work in the Sprint Backlog is completed before the Sprint ends, the Developers can decide how to use the remaining time most effectively. Typically, they would collaborate with the Product Owner to pull additional work from the Product Backlog that they Forecast can be completed within the remaining Sprint time.
Alternatively, the Developers might use this time for process improvement tasks identified during the Sprint Retrospective or to refine the Product Backlog. This approach ensures that any spare time is utilised productively, contributing to the overall Project progress.