Here you can find the source of getJvmFreeMemory()
public static long getJvmFreeMemory()
//package com.java2s; //License from project: Apache License public class Main { private static final long K2M = 1024l * 1024l; public static long getJvmFreeMemory() { return Runtime.getRuntime().freeMemory() / K2M; }//www. j a v a2 s . c o m }