### Question:
CodingUtil { public static short readShort(byte[] buffer) { return (short) (((buffer[1] & 0xff)) | ((buffer[0] & 0xff) << 8)); }  static long readLong(byte[] buffer); static int readInt(byte[] buffer); static short readShort(byte[] buffer);  }### Answer:
@Test public void testReadShort() throws Exception { ByteBuffer buffer = ByteBuffer.allocate(2); buffer.asShortBuffer().put((short) 0); assertEquals(0, CodingUtil.readShort(buffer.array())); buffer.position(0); buffer.asShortBuffer().put((short) (Short.MAX_VALUE / 2)); assertEquals(Short.MAX_VALUE / 2, CodingUtil.readShort(buffer.array())); buffer.position(0); buffer.asShortBuffer().put(Short.MAX_VALUE); assertEquals(Short.MAX_VALUE, CodingUtil.readShort(buffer.array())); buffer.position(0); buffer.asShortBuffer().put((short) 4617); assertEquals(4617, CodingUtil.readShort(buffer.array())); buffer.position(0); buffer.asShortBuffer().put(Short.MIN_VALUE); assertEquals(Short.MIN_VALUE, CodingUtil.readShort(buffer.array())); }