Here you can find the source of getUsedMemory()
public static int getUsedMemory()
//package com.java2s; //License from project: Open Source License public class Main { public static int getUsedMemory() { return (int) (Runtime.getRuntime().totalMemory() / 1024); }// ww w. ja va 2 s . co m }