Here you can find the source of getFreeJVMMemoryMB()
public static long getFreeJVMMemoryMB()
//package com.java2s; public class Main { private final static long mb = 1024 * 1024; public static long getFreeJVMMemoryMB() { return Runtime.getRuntime().freeMemory() / mb; }// w w w . ja v a 2s . co m }