class Const {

  public static int getPercentageFreeMemory() {
    Runtime runtime = Runtime.getRuntime();
    long maxMemory = runtime.maxMemory();
    long allocatedMemory = runtime.totalMemory();
    long freeMemory = runtime.freeMemory();
    long totalFreeMemory = ( freeMemory + ( maxMemory - allocatedMemory ) );

    return (int) Math.round( 100 * (double) totalFreeMemory / maxMemory );
  }

}