### Question:
CodingUtil { public static long readLong(byte[] buffer) { return ((((long) buffer[7] & 0xffL)) | (((long) buffer[6] & 0xffL) << 8) | (((long) buffer[5] & 0xffL) << 16) | (((long) buffer[4] & 0xffL) << 24) | (((long) buffer[3] & 0xffL) << 32) | (((long) buffer[2] & 0xffL) << 40) | (((long) buffer[1] & 0xffL) << 48) | (((long) buffer[0] & 0xffL) << 56)); }  static long readLong(byte[] buffer); static int readInt(byte[] buffer); static short readShort(byte[] buffer);  }### Answer:
@Test public void testReadLong() throws Exception { ByteBuffer buffer = ByteBuffer.allocate(8); buffer.asLongBuffer().put(0); assertEquals(0, CodingUtil.readLong(buffer.array())); buffer.position(0); buffer.asLongBuffer().put(Long.MAX_VALUE); assertEquals(Long.MAX_VALUE, CodingUtil.readLong(buffer.array())); buffer.position(0); buffer.asLongBuffer().put(46517); assertEquals(46517, CodingUtil.readLong(buffer.array())); buffer.position(0); buffer.asLongBuffer().put(Long.MIN_VALUE); assertEquals(Long.MIN_VALUE, CodingUtil.readLong(buffer.array())); }