Here you can find the source of freeMemory()
public static long freeMemory()
//package com.java2s; //License from project: LGPL public class Main { public static long freeMemory() { return Runtime.getRuntime().freeMemory(); }// w ww. j a v a 2s .c o m }