提交 69eeed5b 编写于 作者: L linusflow

修复内存统计数据换算不正确的问题

上级 4ab27305
......@@ -9,12 +9,12 @@ class TimeUtils {
class ByteUtil {
static String toByteString(int bytes) {
if (bytes <= 1024) {
if (bytes <= (1 << 10)) {
return '${bytes}B';
} else if (bytes <= 1024 * 1024) {
return '${(bytes / (1028)).toStringAsFixed(2)}K';
} else if (bytes <= (1 << 20)) {
return '${(bytes >> 10).toStringAsFixed(2)}K';
} else {
return '${(bytes / (1028 * 1024)).toStringAsFixed(2)}M';
return '${(bytes >> 20).toStringAsFixed(2)}M';
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册