How can you get the exact size of a file in bytes.
So, if a file is 308.81MB, how can I get the exact size of the file in bytes? I need to get the exact size of the file because Randomaccessfile's setLength method only excepts long values. That will cause the data to become corrupt in my application. I know how to convert the 308 (multiple by 1048576 = 322961408) part but I don't know what to do with the numbers after the decimal, it comes out as 849346.56 if I multiply it by 1048576. Any ideas on what I can do? I didn't see anything that would help in the API for Randomaccessfile.