Here you can find the source of getMemoryUsage()
public static long getMemoryUsage()
//package com.java2s; //License from project: BSD License public class Main { private static Runtime runtime = Runtime.getRuntime(); public static long getMemoryUsage() { return runtime.totalMemory() - runtime.freeMemory(); }//from www . jav a 2 s . c o m }