Java examples for Java Virtual Machine:Utility
Get Total Memory of Java Virtual Machine(JVM)
public class Main { public static void main(String args[]) {//from w w w . ja va 2 s .c om Runtime runtime = Runtime.getRuntime(); long totalMemory = runtime.totalMemory(); System.out.println(totalMemory + " bytes total in JVM"); } }