Here you can find the source of getMaximumMemory()
static int getMaximumMemory()
//package com.java2s; //License from project: Open Source License public class Main { private static final Runtime RUNTIME = Runtime.getRuntime(); static int getMaximumMemory() { long maxMem = RUNTIME.maxMemory(); if (maxMem > Integer.MAX_VALUE) { return Integer.MAX_VALUE; }//from www. j a v a2 s . c om return (int) maxMem; } }