文件大小
来源:互联网 发布:上海民族乐器一厂 淘宝 编辑:程序博客网 时间:2024/05/17 01:31
public static string humanReadableByteCount(long bytes) { int unit = 1024; if (bytes < unit) return bytes + " B"; int exp = (int)(Math.Log(bytes) / Math.Log(unit)); return String.Format("{0:F1} {1}B", bytes / Math.Pow(unit, exp), "KMGTPE"[exp - 1]); }
将Byte数转为其他单位,如多少KB,MB等
long 1024;
humanReadableByteCount(t);
output:1.0 KB
转自:http://www.cnblogs.com/mgen/archive/2012/01/30/2332161.html
- 文件大小
- 文件大小
- 判断文件大小
- 获取文件大小
- 获取文件大小
- 获取文件大小
- 判断文件大小
- 判断文件大小
- 格式化文件大小
- 获取文件大小
- 文件大小限制
- 查看文件大小
- 获取文件大小
- 获得文件大小
- 查看文件大小
- 判断文件大小
- 监测文件大小
- 取得文件大小
- 逆向分析之LSD基数排序 ;逆向之循环数组队列
- Gstreamer 中的playback插件
- Linux TCP 连接数修改
- 12/9/16 成都网赛 总结
- 标准输入,标准输出和标准出错的缓冲
- 文件大小
- 青蛙又回到了井里
- 逆向之KMP算法 ;逆向之hanoi塔
- lesson1_02
- H264 常见问题(zz from chinavideo)
- Win平台高级编程:完成端口 (IOCP) serial functions
- 数据库: 左连接/右连接/全连接(详细) --复习一下
- OSIP协议栈使用入门(续一:纯协议栈逻辑分析)(转)
- lesson1_03 adapter