Here you can find the source of getMaximumMemory()
public static long getMaximumMemory()
//package com.java2s; //License from project: Open Source License public class Main { public static long getMaximumMemory() { long maximumMemory = Runtime.getRuntime().maxMemory(); long totalMemory = Runtime.getRuntime().totalMemory(); if ((maximumMemory <= 0) || (maximumMemory == Long.MAX_VALUE)) { // if maximum memory can not be determined or isn't defined, then default to the totalMemory maximumMemory = totalMemory; }/*from ww w .j a v a 2s .com*/ return maximumMemory; } }