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