Here you can find the source of getTotalMemory()
public static long getTotalMemory()
//package com.java2s; /*/*from ww w . j a v a2 s . c o m*/ * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ public class Main { private static Runtime runtime = Runtime.getRuntime(); public static long getTotalMemory() { return runtime.totalMemory(); } }