Java Runtime.maxMemory()
Syntax
Runtime.maxMemory() has the following syntax.
public long maxMemory()
Example
In the following code shows how to use Runtime.maxMemory() method.
public class Main {
/*w w w. java 2s.co m*/
public static void main(String[] args) {
// print the maximum memory
System.out.println(Runtime.getRuntime().maxMemory());
}
}
The code above generates the following result.