Hacker News new | ask | show | jobs
by emerongi 993 days ago
The author apparently went back to using a loop after recognizing that it's not readable: https://programming.guide/java/formatting-byte-size-to-human...

Notably, it's still slightly better than the first code example in the original article, as it takes the rounding bug into account.