Java examples for java.lang:Runtime
get Max Memory
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getMaxMemory()); }//w w w .ja v a2 s . c o m public static long getMaxMemory() { return bytesToMegabytes(Runtime.getRuntime().maxMemory()); } private static long bytesToMegabytes(long bytes) { long MEGABYTE = 1024L * 1024L; return bytes / MEGABYTE; } }