Here you can find the source of totalMemory()
public static long totalMemory()
//package com.java2s; public class Main { static Runtime runtime = Runtime.getRuntime(); public static long totalMemory() { return runtime.totalMemory(); }/* w w w. ja va 2s. c om*/ }