static int readIntegerLittleEndian(byte[] data, int offset) {
    return Byte.toUnsignedInt(data[offset])
        | (Byte.toUnsignedInt(data[offset + 1]) << 8)
        | (Byte.toUnsignedInt(data[offset + 2]) << 16)
        | (Byte.toUnsignedInt(data[offset + 3]) << 24);
  }
@Test
  public void testReadIntegerLittleEndian() {
    testReadIntegerLittleEndian(bytes(0, 0, 0, 0), 0, 0);
    testReadIntegerLittleEndian(bytes(42, 0, 0, 0), 0, 42);
    testReadIntegerLittleEndian(bytes(13, 42, 0, 0, 0, 14), 1, 42);
    testReadIntegerLittleEndian(bytes(13, 0xFa, 0xFF, 0xFF, 0x7F, 14), 1, Integer.MAX_VALUE - 5);
    testReadIntegerLittleEndian(bytes(13, 0xF9, 0xFF, 0xFF, 0xFF, 14), 1, -7);
  }