import java.util.*; class GarbageCollector{ public static void main(String[]args){ System.gc(); Runtime rt = Runtime.getRuntime(); long total = rt.total(); long free = rt.free(); long max = rt.max(); System.out.println("total"+total+"bytes"); System.out.println("free"+free+"bytes"); System.out.println("max"+max+"bytes"); rt.gc(); total = rt.total(); free = rt.free(); max = rt.max(); System.out.println("total after gc"+total+"bytes"); System.out.println("free after gc"+free+"bytes"); System.out.println("max after gc"+max+"bytes"); } }