"Example source code to read Total, Available, Used and Free Memmory with Java"
new Thread(){
@Override
public void run() {
while (1==1){
long total = Runtime.getRuntime().totalMemory();
long free = Runtime.getRuntime().freeMemory();
long used = total - free;
int availP = Runtime.getRuntime().availableProcessors();
System.out.println(""+free);
System.out.println(""+used);
System.out.println(""+total);
System.out.println(""+availP);
try{
Thread.sleep(10000);
}
catch (InterruptedException e){
}
}
}
}.start();