Code example for DecimalFormat

Methods: format, setMaximumFractionDigits, setMinimumFractionDigits

0
	/* 
	 * Show Heap 
	 */ 
	@SuppressWarnings("rawtypes") 
	public static void logHeap(Class clazz) {
		DecimalFormat df = new DecimalFormat();
		df.setMaximumFractionDigits(2);
		df.setMinimumFractionDigits(2);
		Log.d(clazz.getName(),
						"DEBUG_MEMORY allocated " + df.format(Double.valueOf(Runtime.getRuntime().totalMemory() / 1048576)) + "/"
										+ df.format(Double.valueOf(Runtime.getRuntime().maxMemory() / 1048576)) + "MB ("
										+ df.format(Double.valueOf(Runtime.getRuntime().freeMemory() / 1048576)) + "MB free)");
		System.gc();
		System.gc();
	} 
	 
}