Here you can find the source of getMemoryUsege()
public static String getMemoryUsege()
//package com.java2s; //License from project: Open Source License public class Main { public static String getMemoryUsege() { return String.format("memory={total: %d MB, free: %d MB, used: %d MB, max: %d MB}", (Runtime.getRuntime().totalMemory() / 1000 / 1000), (Runtime.getRuntime().freeMemory() / 1000 / 1000), ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000 / 1000), (Runtime.getRuntime().maxMemory() / 1000 / 1000)); }// w ww .j av a2 s . co m }