Here you can find the source of getMaximumMemory()
public static int getMaximumMemory()
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w. java 2 s .com * Returns the available maximum amount of memory (in MB) this JVM can use. * * @return maximum memory */ public static int getMaximumMemory() { return Math.round((float) (Runtime.getRuntime().maxMemory() / 1048576L)); } }