Here you can find the source of getTotalMemoryStringInMb()
public static String getTotalMemoryStringInMb()
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { final static DecimalFormat memroyFormat = new DecimalFormat("#,##0.00 Mb"); final static double MB_Numeral = 1024d * 1024d; public static String getTotalMemoryStringInMb() { return memroyFormat.format(getTotalMemoryInMb()); }/*from w w w .j a v a 2s . c o m*/ public static double getTotalMemoryInMb() { return Runtime.getRuntime().totalMemory() / MB_Numeral; } }