Added a Jee Ajax upload class

This commit is contained in:
Ziver Koc 2010-08-18 17:35:25 +00:00
parent 5d504a3a59
commit 542ee5a3cb
13 changed files with 532 additions and 2 deletions

View file

@ -6,6 +6,7 @@ package zutil;
* @author Ziver *
*/
public class StringUtil {
public static final String[] sizes = new String[]{"YB", "ZB", "EB", "PB", "TB", "GB", "MB", "kB", "B"};
/**
* Present a size (in bytes) as a human-readable value
@ -14,7 +15,6 @@ public class StringUtil {
* @return string
*/
public static String formatBytesToString(long bytes){
String[] sizes = new String[]{"YB", "ZB", "EB", "PB", "TB", "GB", "MB", "kB", "B"};
int total = sizes.length-1;
double value = bytes;
@ -22,7 +22,7 @@ public class StringUtil {
value /= 1024;
}
value = (double)( (int)(value*100) )/100;
value = (double)( (int)(value*10) )/10;
return value+" "+sizes[total];
}