Use decimal digit groups in file size pretty printing.

master
Alan Evans 2019-12-04 14:44:37 -05:00 committed by Greyson Parrelli
parent 977591ac82
commit a0ecba147e
1 changed files with 2 additions and 2 deletions

View File

@ -539,9 +539,9 @@ public class Util {
if (sizeBytes <= 0) return "0";
String[] units = new String[]{"B", "kB", "MB", "GB", "TB"};
int digitGroups = (int) (Math.log10(sizeBytes) / Math.log10(1024));
int digitGroups = (int) (Math.log10(sizeBytes) / 3);
return new DecimalFormat("#,##0.#").format(sizeBytes/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
return new DecimalFormat("#,##0.#").format(sizeBytes/Math.pow(1000, digitGroups)) + " " + units[digitGroups];
}
public static void sleep(long millis) {