Code example for DecimalFormat

Methods: setMaximumFractionDigitssetMinimumFractionDigitsformat

0
		if (!DEBUG) return;
 
	    Double allocated = new Double(android.os.Debug.getNativeHeapAllocatedSize()) / new Double((1048576));
	    Double available = new Double(android.os.Debug.getNativeHeapSize() / 1048576.0);
	    Double free = new Double(android.os.Debug.getNativeHeapFreeSize() / 1048576.0);
	    DecimalFormat df = new DecimalFormat();
	    df.setMaximumFractionDigits(2);
	    df.setMinimumFractionDigits(2);
 
	    Log.e("MEM", "" + System.currentTimeMillis() + " - DUMP: " + msg);
	    Log.e("MEM", "Memory Heap Debug. ==============================================================================================================");
	    Log.e("MEM", "Memory Heap Native: Allocated " + df.format(allocated) + "MB of " + df.format(available) + "MB (" + df.format(free) + "MB free) in [" + mClass.getName() + "]");
	    Log.e("MEM", "Memory Heap App: Allocated: " + df.format(new Double(Runtime.getRuntime().totalMemory() / 1048576)) + "MB of " + df.format(new Double(Runtime.getRuntime().maxMemory() / 1048576)) + "MB (" + df.format(new Double(Runtime.getRuntime().freeMemory() / 1048576)) + "MB free)");
	    Log.e("MEM", "Memory Heap Debug. ==============================================================================================================");
	} 
} 
Experience pair programming with AI  Get Codota for Java