`
rekoe.net
  • 浏览: 8729 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

检查 字节流的大小

阅读更多
public static String sizeFormat(long dataSize){
		if(dataSize>=1073741824){
			return ((double) Math.round(dataSize / 1073741824d * 100) / 100)+ " GB";
		}else if(dataSize>=1048576){
			return ((double) Math.round(dataSize / 1048576d * 100) / 100)+ " MB";
		}else if(dataSize>=1024){
			return ((double) Math.round(dataSize / 1024d * 100) / 100)+ " KB";
		}else{
			return dataSize+ " Bytes";
		}
	}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics