public static int toIntSize(long size) {
        assert size >= 0 : "Invalid size value: " + size;
        return size > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) size;
    }
@Test(expected = AssertionError.class)
    @RequireAssertEnabled
    public void toIntSize_whenNegative() {
        long size = -1;
        assertEquals((int) size, toIntSize(size));
    }