Back to project page psiandroid.
The source code is released under:
GNU General Public License
If you think the Android project psiandroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.phpsysinfo.utils; //w ww.j a v a 2 s .com import java.text.NumberFormat; import com.phpsysinfo.R; import com.phpsysinfo.activity.PSIActivity; public class FormatUtils { public static String getFormatedMemory(int memory) { NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(1); String value = "0"; if(memory > 1024*1024) { value = nf.format((float)memory/1024/1024) + " " + PSIActivity.getAppContext().getString(R.string.lblTio); } else if(memory > 1024) { value = nf.format((float)memory/1024) + " " + PSIActivity.getAppContext().getString(R.string.lblGio); } else { value = nf.format(memory) + " " + PSIActivity.getAppContext().getString(R.string.lblMio); } return value; } }