Here you can find the source of getJvmMaxMemory()
public static long getJvmMaxMemory()
//package com.java2s; //License from project: Apache License public class Main { private static final long K2M = 1024l * 1024l; public static long getJvmMaxMemory() { return Runtime.getRuntime().maxMemory() / K2M; }/*from w w w .java 2s . co m*/ }