ByteRead { public static long getLong(byte[] src, int startIndex) { Check.EnsureIndex(src, startIndex, 8); long value1 = (getInt(src, startIndex) & MASK_INT) << 32; long value2 = (getInt(src, startIndex + 4) & MASK_INT); return value1 | value2; } private  ByteRead(); static byte getByte(byte[] src, int startIndex); static boolean getBoolean(byte[] src, int startIndex); static short getUnsignedByte(byte[] src, int startIndex); static short getShort(byte[] src, int startIndex); static int getInt(byte[] src, int startIndex); static long getLong(byte[] src, int startIndex); static byte[] getBytes(byte[] src, int startIndex); static byte[] getBytes(byte[] src, int startIndex, int size);  }
@Test public void testLong() { final long TEST_CASE = 1642146535132L; ByteBuffer buffer = ByteBuffer.allocate(8); buffer = buffer.order(ByteOrder.BIG_ENDIAN); buffer.putLong(TEST_CASE); long readLong = ByteRead.getLong(buffer.array(), 0); Assert.assertEquals(TEST_CASE, readLong); }