Java tutorial
//package com.java2s; //License from project: Apache License import android.annotation.TargetApi; import android.app.ActivityManager; import android.content.Context; import android.os.Build; public class Main { @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static long getTotalMemoryJB(Context context) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); return mi.totalMem; } }