Java Utililty Methods Memory Max

List of utility methods to do Memory Max

Description

The list of methods to do Memory Max are organized into topic(s).

Method

intmaxMemoryInMbs()
max Memory In Mbs
return (int) (Runtime.getRuntime().maxMemory() / (1024 * 1024));
doublemaxMemoryMB()
Get maximum memory in megabytes
return megaBytes(Runtime.getRuntime().maxMemory());
longmemoryMax()
memory Max
long mem = 0;
for (int i = 0; i < 10; i++)
    mem += runtime.maxMemory();
mem /= 10;
return mem;
intmemoryMax()
memory Max
Runtime runtime = Runtime.getRuntime();
return Math.round(runtime.maxMemory() / 1024f);