public static long calculate(final float percentage) {
        if (percentage <= 0 || percentage > 1) {
            throw new IllegalArgumentException();
        }
        checkAndScheduleRefresh();
        return (long) (maxAvailable() * percentage);
    }
@Test
    public void testCalculate() {
        float percentage = 0.5f;
        assertEquals((long) (MemoryLimitCalculator.maxAvailable() * percentage), MemoryLimitCalculator.calculate(percentage));
    }