public static long calculate(final float percentage) {
        if (percentage <= 0 || percentage > 1) {
            throw new IllegalArgumentException();
        }
        checkAndScheduleRefresh();
        return (long) (maxAvailable() * percentage);
    }
@Test
    public void testCalculateWhenIllegalPercentage() {
        float largerThanOne = 2;
        float zero = 0;
        float lessThanZero = -1;
        assertThrows(IllegalArgumentException.class, () -> MemoryLimitCalculator.calculate(largerThanOne));
        assertThrows(IllegalArgumentException.class, () -> MemoryLimitCalculator.calculate(zero));
        assertThrows(IllegalArgumentException.class, () -> MemoryLimitCalculator.calculate(lessThanZero));
    }