public class Memory
{
public static long usingMemory()
{
for(int i=0; i<3; i++)
{
System.gc();
}
long total = Runtime.getRuntime().totalMemory();
long free = Runtime.getRuntime().freeMemory();
return total - free;
}
private final Runtime s_runtime = Runtime.getRuntime();
}