Here you can find the source of getMemInfo()
public static String getMemInfo()
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; import java.util.Locale; public class Main { private static Runtime runtime = Runtime.getRuntime(); public static String getMemInfo() { NumberFormat format = NumberFormat.getInstance(Locale.ITALIAN); StringBuilder sb = new StringBuilder(); long allocatedMemory = runtime.totalMemory(); sb.append(format.format(allocatedMemory / 1024 / 1024)).append(" MB"); return sb.toString(); }//from www . jav a 2s . c om }