Java tutorial
//package com.java2s; //License from project: Open Source License import android.os.Environment; import android.os.StatFs; import java.io.File; public class Main { public static long[] getRomMemroy() { long[] romInfo = new long[2]; //Total rom memory romInfo[0] = getTotalInternalMemorySize(); //Available rom memory File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); romInfo[1] = blockSize * availableBlocks; return romInfo; } public static long getTotalInternalMemorySize() { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return totalBlocks * blockSize; } }