Here you can find the source of memoryFree()
public static int memoryFree()
//package com.java2s; //License from project: Open Source License public class Main { public static int memoryFree() { Runtime runtime = Runtime.getRuntime(); return Math.round(runtime.freeMemory() / 1024f); }/* www.j ava 2 s . c om*/ }