Java tutorial
public class Main { public static void main(String[] args) { Runtime runTime = Runtime.getRuntime(); // print the number of free bytes System.out.println(runTime.freeMemory()); } }