android长度转单位
2016-07-26 15:21
627 查看
android长度转单位
public static String formatFileLength(long length) { if (length >> 30 > 0L) { float sizeGb = Math.round(10.0F * (float) length / 1.073742E+009F) / 10.0F; return sizeGb + " GB"; } if (length >> 20 > 0L) { return formatSizeMb(length); } if (length >> 9 > 0L) { float sizekb = Math.round(10.0F * (float) length / 1024.0F) / 10.0F; return sizekb + " KB"; } return length + " B"; } public static String formatSizeMb(long length) { float mbSize = Math.round(10.0F * (float) length / 1048576.0F) / 10.0F; return mbSize + " MB"; }
相关文章推荐
- Android签名生成keystore
- Android ActionBar的使用
- android开发中总会遇到的小问题【持续更新...】
- Android学习之路------VideoView
- Android 下拉刷新控件
- Android自定义view生命周期
- Android定制及替换launcher
- Android游戏——贪吃蛇开发实录(改进后的源码和详解)
- Android中 Intent 与 Intent-filter
- Android 反编译
- Android中Bitmap的剪切与拉伸
- Android M 新的运行时权限开发者需要知道的一切
- [Android][Android Studio] *.jar 与 *.aar 的生成与*.aar导入项目方法
- android 虚拟键适配PopupWindow显示位置
- Android AudioRecorder录制mp3文件 RAW转MP3
- [置顶] Android开发之去掉listview的点击效果,一行代码间接粗暴,解决你的问题。
- android studio tabhost基础 多功能时钟app 使用sharedpreference存储闹钟数据(三)
- Android Studio 快捷键
- android studio调用JNI
- android studio 调用.so 文件时报错has text relocations