### Question:
IoUtils { public static int readUnsignedShort(InputStream in) throws IOException { int b0 = safeRead(in); int b1 = safeRead(in); return b1 << 8 | b0; } private  IoUtils(); static int safeRead(InputStream in); static int readShort(InputStream in); static int readUnsignedShort(InputStream in); static void writeShort(OutputStream out, int i); static void writeInt(OutputStream out, int i); static int readUnsignedMediumInt(InputStream in); static int readMediumInt(InputStream in); static int readInt(InputStream in); static long readUnsignedInt(InputStream in); static long readLong(InputStream in); static long readBinaryLengthEncoding(InputStream in); static long readBinaryLengthEncoding(InputStream in, int firstByte); static String readLengthCodedString(InputStream in, String charset); static String readLengthCodedString(InputStream in, int firstByte, String charset); static String readString(InputStream in, String charset); static String readFixedLengthString(InputStream in, int length, String charset); static Set<FieldFlag> readEnumSet(InputStream in, Class<FieldFlag> enumClass); static EnumSet<E> readEnumSetShort(InputStream in, Class<E> enumClass); static E readEnum(InputStream in, Class<E> enumClass); static void writeEnumSetShort(OutputStream out, Set<E> set); static final int NULL_VALUE; }### Answer:
@Test(dependsOnMethods="testSafeRead") public void testReadUnsignedShort() throws IOException { ByteBuffer buffer = ByteBuffer.allocate(1024); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.putShort((short)0).putShort((short)1).putShort((short)2).putShort((short)-1).putShort((short)-2); InputStream in = new ByteArrayInputStream(buffer.array(), 0, buffer.position()); Assert.assertEquals(IoUtils.readUnsignedShort(in), 0); Assert.assertEquals(IoUtils.readUnsignedShort(in), 1); Assert.assertEquals(IoUtils.readUnsignedShort(in), 2); Assert.assertEquals(IoUtils.readUnsignedShort(in), 0xffff); Assert.assertEquals(IoUtils.readUnsignedShort(in), 0xfffe); }