Android examples for Hardware:Memory
get Java Heap Size
//package com.java2s; import android.os.Build; import android.os.Debug; public class Main { public static long getJavaHeapSize() { if (Build.VERSION.SDK_INT >= 9) { return Runtime.getRuntime().totalMemory(); } else {/*from w ww .jav a2 s. c o m*/ return Runtime.getRuntime().totalMemory() + Debug.getNativeHeapAllocatedSize(); } } }