Here you can find the source of getPercentMemUse()
public static String getPercentMemUse()
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; public class Main { private static Runtime runtime = Runtime.getRuntime(); private static NumberFormat format = NumberFormat.getInstance(); public static String getPercentMemUse() { return format.format(((float) runtime.totalMemory() / (float) runtime.maxMemory()) * 100); }/*from w w w .j ava 2 s .com*/ }