Here you can find the source of getMemoryFootprint()
public static String getMemoryFootprint()
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { private static final NumberFormat MEM_FMT = new DecimalFormat( "##,###.##"); public static String getMemoryFootprint() { Runtime runtime = Runtime.getRuntime(); String memoryInfo = "Memory - free:" + kbString(runtime.freeMemory()) + " - max:" + kbString(runtime.maxMemory()) + " - total:" + kbString(runtime.totalMemory()); return memoryInfo; }//w ww . ja v a2 s . c o m public static String kbString(long memBytes) { return MEM_FMT.format(memBytes / 1024) + " kb"; } }