Here you can find the source of usedMemory()
public static long usedMemory()
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt public class Main { private static final Runtime S_RUNTIME = Runtime.getRuntime(); public static long usedMemory() { return S_RUNTIME.totalMemory() - S_RUNTIME.freeMemory(); }/*from w w w.ja v a2 s . c o m*/ public static long totalMemory() { return S_RUNTIME.totalMemory(); } public static long freeMemory() { return S_RUNTIME.freeMemory(); } }