Here you can find the source of getMemoryString()
public static String getMemoryString()
//package com.java2s; public class Main { private static final int FACTOR_MB = 1024 * 1024; /**/*from www . j av a2 s . c o m*/ * Gets a String containing info of available and used memory of this JVM. * @return an info string. */ public static String getMemoryString() { return "Mem Total in JVM: " + (Runtime.getRuntime().totalMemory() / FACTOR_MB) + " Free in JVM: " + (Runtime.getRuntime().freeMemory() / FACTOR_MB) + " Max Limit: " + (Runtime.getRuntime().maxMemory() / FACTOR_MB); } }