@Test
public void toInt() throws Exception {

    try {
        ByteArrayUtil.toInt(null);
        Assert.fail();
    } catch (IllegalArgumentException e) {
        // correct behavior
    }
    Assert.assertEquals((int)0x12345678, ByteArrayUtil.toInt(new byte[] { (byte)0x12, (byte)0x34, (byte)0x56, (byte)0x78 }));
    Assert.assertEquals((int)0x34567890, ByteArrayUtil.toInt(new byte[] { (byte)0x12, (byte)0x34, (byte)0x56, (byte)0x78, (byte)0x90 }, 1, 4));
}