#26 change param to double, to allow double arithmetic

master
Wolf Posdorfer 2019-10-06 20:58:47 +02:00
parent abb0be6620
commit fae41f1742
1 changed files with 2 additions and 2 deletions

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]);
} }
} }