You're working on a file system implementation in Java and need to calculate how much disk space a file actually occupies when stored on disk. Note: The code will be compiled and executed using JDK 21 (latest).
For a file of 1500 bytes on a disk with 512-byte clusters:
Implement the computeSizeOnDisk method in Java that calculates the total disk space used by a file given the cluster size and file size (in bytes).
Do not include a main() method; your code will be wrapped automatically.
The solution will be executed using JDK 21 (latest).
1500 bytes requires 3 clusters of 512 bytes each, totaling 1536 bytes.
2048 bytes fits exactly in 2 clusters of 1024 bytes.
513 bytes requires 2 clusters because one cluster (512 bytes) is insufficient.