- 1
What do they mean by 1024?
return number%1024
5 Answers
+ 22
2^10
//u want remainder , after getting divided by 1024 âș
+ 9
it seems like this could be used to calculate Kilo bytes from bytes (Division: BYTES / 1024)
Because there's 1024 bytes in 1 KB
When people are loading a file and they get the size of the file it is returned in bytes, so it is necessary to do this step to get the KB of the file:
1 KB = 1024 bytes
If you use % (Mod) You'll always get a number between 0 and 1023, this it's a good way to see if the file is "perfectly rounded" to (1024 * x) bytes [ x = any integer]
If it's not 0 it will return how many bytes are in excess.
0
that is what you divide by
0
it is the power 10 of number 2