Runtime.totalMemory() has the following syntax.
public long totalMemory()
In the following code shows how to use Runtime.totalMemory() method.
/*from w w w . j av a2 s. co m*/ public class Main { public static void main(String[] args) { // print the total memory System.out.println(Runtime.getRuntime().totalMemory()); } }
The code above generates the following result.