Here you can find the source of getUsageMemory()
public static long getUsageMemory()
//package com.java2s; //License from project: Open Source License public class Main { public static long getUsageMemory() { return getAllocatedMemory() - getFreeMemory(); }/*from w ww.j av a2 s .c o m*/ public static long getAllocatedMemory() { return Runtime.getRuntime().totalMemory(); } public static long getFreeMemory() { return Runtime.getRuntime().freeMemory(); } }