* i2psnark: Listing fixes and cleanups; icons on front page; tweak bw choker again

This commit is contained in:
zzz
2010-05-26 14:28:46 +00:00
parent b61e2aa73c
commit 9132e94143
7 changed files with 127 additions and 68 deletions

View File

@@ -1029,6 +1029,30 @@ public class DataHelper {
}
}
/**
* Like formatSize but with a space after the number
* @since 0.7.14
*/
public static String formatSize2(long bytes) {
double val = bytes;
int scale = 0;
while (val >= 1024) {
scale++;
val /= 1024;
}
DecimalFormat fmt = new DecimalFormat("##0.00");
String str = fmt.format(val);
switch (scale) {
case 1: return str + " K";
case 2: return str + " M";
case 3: return str + " G";
case 4: return str + " T";
default: return bytes + " ";
}
}
/**
* Strip out any HTML (simply removing any less than / greater than symbols)
*/