Here you can find the source of isMemorySufficient()
public static boolean isMemorySufficient()
//package com.java2s; public class Main { public static boolean isMemorySufficient() { final long maxMemory = ((Runtime.getRuntime().maxMemory() / 1024) / 1024); final long freeMemory = ((Runtime.getRuntime().freeMemory() / 1024) / 1024); if ((freeMemory) < ((1 * maxMemory) / 100)) { return false; }/*from w ww . j av a 2 s. c o m*/ return true; } }