@Override
    public int[] borrowIntArray(int positionCount)
    {
        checkState(getBorrowedArrayCount() < maxOutstandingArrays, "Requested too many arrays: %s", getBorrowedArrayCount());
        int[] array;
        while (!intArrays.isEmpty() && intArrays.peek().length < positionCount) {
            array = intArrays.pop();
            estimatedSizeInBytes -= sizeOf(array);
        }
        if (intArrays.isEmpty()) {
            array = new int[positionCount];
            estimatedSizeInBytes += sizeOf(array);
        }
        else {
            array = intArrays.pop();
        }
        verify(borrowedIntArrays.add(array), "Attempted to borrow array which was already borrowed");
        return array;
    }
@Test
    public void testOverAllocateLeases()
    {
        SimpleArrayAllocator allocator = new SimpleArrayAllocator(2);

        allocator.borrowIntArray(10);
        allocator.borrowIntArray(10);
        assertThrows(IllegalStateException.class, () -> allocator.borrowIntArray(10));
    }