Here you can find the source of memoryMax()
public static long memoryMax()
//package com.java2s; //License from project: Open Source License public class Main { private static Runtime runtime; public static long memoryMax() { long mem = 0; for (int i = 0; i < 10; i++) mem += runtime.maxMemory();/* w w w. j av a2s. c o m*/ mem /= 10; return mem; } }