Here you can find the source of maxMemory()
public static long maxMemory()
//package com.java2s; //License from project: Apache License public class Main { /**/*from ww w . jav a 2 s. co m*/ * @return the maximum amount of memory that the virtual machine will * attempt to use, measured in bytes */ public static long maxMemory() { return Runtime.getRuntime().maxMemory(); } }