Here you can find the source of getMemoryUsedBytes ()
public static long getMemoryUsedBytes ()
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file public class Main { public static long getMemoryUsedBytes() { final Runtime runtime = Runtime.getRuntime(); return runtime.totalMemory() - runtime.freeMemory(); }/*w w w . ja v a 2 s . c om*/ }