Here you can find the source of reportMemory()
public static void reportMemory()
//package com.java2s; //License from project: Open Source License public class Main { public static void reportMemory() { Runtime runtime = Runtime.getRuntime(); long mb = 1024 * 1024; // long max = runtime.maxMemory(); long used = runtime.totalMemory() - runtime.freeMemory(); System.out.printf("......................... memory in use: %d MB .........................%n", used / mb); }/*from w w w .j a v a 2 s . c o m*/ }