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