public static boolean isPermutation(IntArrayList arr) {
        BitSet present = new BitSet(arr.size());
        for (IntCursor e : arr) {
            if (e.value >= arr.size() || e.value < 0)
                return false;
            if (present.get(e.value))
                return false;
            present.set(e.value);
        }
        return true;
    }
@Test
    public void testIsPermutation() {
        assertTrue(ArrayUtil.isPermutation(IntArrayList.from()));
        assertTrue(ArrayUtil.isPermutation(IntArrayList.from(0)));
        assertTrue(ArrayUtil.isPermutation(IntArrayList.from(0, 1)));
        assertTrue(ArrayUtil.isPermutation(IntArrayList.from(6, 2, 4, 0, 1, 3, 5)));
        assertFalse(ArrayUtil.isPermutation(IntArrayList.from(1, 2)));
        assertFalse(ArrayUtil.isPermutation(IntArrayList.from(-1)));
        assertFalse(ArrayUtil.isPermutation(IntArrayList.from(1)));
        assertFalse(ArrayUtil.isPermutation(IntArrayList.from(3, 4, 0, 1)));
        assertFalse(ArrayUtil.isPermutation(IntArrayList.from(0, 1, 3, 3, 4, 4, 6)));
    }