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