Comment by Cthulhu_

4 years ago

Until it does.

The original doesn't have types, but the modified version of humanReadableByteCount() uses a "long bytes" and as such will fail if the file size is (Long.MAX_VALUE+1) because it cannot even accept the correct size as its argument in the first place. Implementing these edge cases makes adds one more working case to 2^63 (2^64 if negative file sizes are valid) when the bigger problem is using the type "long" when files of that size are possible on the target system.

Readability and maintainability matters far more.

And no - the edge cannot occur as it would require a file / whatever to have that size.