public static long readLong(byte[] bytes, int offset) {
    return (((long) (bytes[offset] & 0xff) << 56)
        | ((long) (bytes[offset + 1] & 0xff) << 48)
        | ((long) (bytes[offset + 2] & 0xff) << 40)
        | ((long) (bytes[offset + 3] & 0xff) << 32)
        | ((long) (bytes[offset + 4] & 0xff) << 24)
        | ((long) (bytes[offset + 5] & 0xff) << 16)
        | ((long) (bytes[offset + 6] & 0xff) << 8)
        | (long) (bytes[offset + 7] & 0xff));
  }
@Test
  public void testReadLong() {
    assertEquals(-4020014679618420408L, IOUtils.readLong(BYTE_ARRAY, 0));
    assertEquals(3893910145419266185L, IOUtils.readLong(BYTE_ARRAY, 1));
    assertEquals(716817247016356198L, IOUtils.readLong(BYTE_ARRAY, 2));
  }