Reputation: 449
Here I am getting file size in bytes format in
org.springframework.web.multipart.MultipartFile.getSize();
but I want to convert this to kb format, how can I convert bytes into kb's in java.
Upvotes: 0
Views: 2198
Reputation: 1978
1 Kilobyte = 1000 bytes
1 Kibibyte = 1024 bytes
long bytes = org.springframework.web.multipart.MultipartFile.getSize();
long kilobytes = bytes / 1000;
long kibibytes = bytes / 1024;
Kilobyte in Wikipedia
Upvotes: 2