Here you can find the source of memoryMax()
public static int memoryMax()
//package com.java2s; //License from project: Open Source License public class Main { public static int memoryMax() { Runtime runtime = Runtime.getRuntime(); return Math.round(runtime.maxMemory() / 1024f); }/*from w w w.j av a2 s . co m*/ }