This commit is contained in:
Redkale
2018-04-02 20:53:23 +08:00
parent 643827354c
commit 742c352080

View File

@@ -162,9 +162,10 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
}
protected static String formatLenth(long value) {
if (value > 1024 * 1024 * 1024) return value / (1024 * 1024 * 1024) + "G";
if (value > 1024 * 1024) return value / (1024 * 1024) + "M";
if (value > 1024) return value / (1024) + "K";
if (value < 1) return "" + value;
if (value % (1024 * 1024 * 1024) == 0) return value / (1024 * 1024 * 1024) + "G";
if (value % (1024 * 1024) == 0) return value / (1024 * 1024) + "M";
if (value % 1024 == 0) return value / (1024) + "K";
return value + "B";
}