Here you can find the source of memory()
public static String memory()
//package com.java2s; //License from project: Open Source License public class Main { public static String memory() { String str = ""; str += "memory : " + ((double) Runtime.getRuntime().freeMemory() / (double) Runtime.getRuntime().totalMemory()) * 100 + "% free<br>"; str += "memory total : " + Runtime.getRuntime().totalMemory() + "<br>"; str += "memory free : " + Runtime.getRuntime().freeMemory() + "<br>"; return str; }//from w w w .ja v a 2 s . com }