Here you can find the source of memoryFree()
public static long memoryFree()
//package com.java2s; //License from project: Open Source License public class Main { private static Runtime runtime; public static long memoryFree() { long mem = 0; for (int i = 0; i < 10; i++) mem += runtime.freeMemory(); mem /= 10;/* w ww. j ava 2 s. c o m*/ return mem; } }