#26 change param to double, to allow double arithmetic

This commit is contained in:
Wolf Posdorfer 2019-10-06 20:58:47 +02:00
parent abb0be6620
commit fae41f1742

View file

@ -220,13 +220,13 @@ public class NSTableViewController implements Initializable {
} }
private String formatByteSize(long length) { private String formatByteSize(double length) {
final String[] unitNames = { "bytes", "KiB", "MiB", "GiB", "TiB"}; final String[] unitNames = { "bytes", "KiB", "MiB", "GiB", "TiB"};
int i; int i;
for (i = 0; length > 1024 && i < unitNames.length - 1; i++) { for (i = 0; length > 1024 && i < unitNames.length - 1; i++) {
length = length / 1024; length = length / 1024;
} }
return String.format("%,d %s", length, unitNames[i]); return String.format("%,.2f %s", length, unitNames[i]);
} }
} }