Here you can find the source of memoryTotal()
public static long memoryTotal()
//package com.java2s; //License from project: Open Source License public class Main { private static Runtime runtime; public static long memoryTotal() { long mem = 0; for (int i = 0; i < 10; i++) mem += runtime.totalMemory(); mem /= 10;// w w w . j a v a 2 s. co m return mem; } }