Here you can find the source of maxMemoryInMbs()
private static int maxMemoryInMbs()
//package com.java2s; //License from project: Apache License public class Main { /**/* w ww . ja v a2s . co m*/ * @return The maximum JVM heap size in Mbs, rounded down. */ private static int maxMemoryInMbs() { return (int) (Runtime.getRuntime().maxMemory() / (1024 * 1024)); } }