Here you can find the source of getFreeMemoryInMb()
public static double getFreeMemoryInMb()
//package com.java2s; //License from project: Apache License public class Main { final static double MB_Numeral = 1024d * 1024d; public static double getFreeMemoryInMb() { return Runtime.getRuntime().freeMemory() / MB_Numeral; }//from w ww. j a va 2s. co m }