Human-Readable File Sizes

6. September, 2011

Every now and then, you need to show a number to a human. In some cases, those numbers can range from very small to huge. File sizes are an example.

Here is a very short code sample how to get a nice file size for human consumption: How to convert byte size into human readable format in java?

Best of all: It’s four lines of code but it can handle SI and non-SI units.