public static int toSignedInt(long x) {
        return (int) x;
    }
@Test
    public void testUnsignedConversions() {
        long l = Integer.toUnsignedLong(-1);
        assertEquals(4294967295L, l);
        assertEquals(-1, BitUtil.toSignedInt(l));

        int intVal = Integer.MAX_VALUE;
        long maxInt = intVal;
        assertEquals(intVal, BitUtil.toSignedInt(maxInt));

        intVal++;
        maxInt = Integer.toUnsignedLong(intVal);
        assertEquals(intVal, BitUtil.toSignedInt(maxInt));

        intVal++;
        maxInt = Integer.toUnsignedLong(intVal);
        assertEquals(intVal, BitUtil.toSignedInt(maxInt));

        assertEquals(0xFFFFffffL, (1L << 32) - 1);
        assertTrue(0xFFFFffffL > 0L);
    }