/*
 * @(#)src/demo/misc/JavaMemory.java, core, ds142, 20040714 1.7.2.1
 * ===========================================================================
 * Licensed Materials - Property of IBM
 * "Restricted Materials of IBM"
 *
 * IBM SDK, Java(tm) 2 Technology Edition, v1.4.2
 * (C) Copyright IBM Corp. 1998, 2002. All Rights Reserved
 * ===========================================================================
 */




/*
 * Title: JavaMemory
 *
 * Description: Displays free and total memory usage
 *
 * Usage: java JavaMemory
 *
 */

public class JavaMemory {

	public static void main(String[] args) {
		Runtime runtime = Runtime.getRuntime();
		long freeKMem = runtime.freeMemory()/1024;
		long totalKMem = runtime.totalMemory()/1024;
		long freeMMem = runtime.freeMemory()/1024/1024;
		long totalMMem = runtime.totalMemory()/1024/1024;
		System.out.println("Free Mem:"+freeKMem+"KB ("+freeMMem+"MB), Total Mem:"+totalKMem+"KB ("+totalMMem+"MB)");
	}
}

