- public static short readShort(InputStream in) throws IOException {
- byte a = (byte) in.read();
- byte b = (byte) in.read();
- ByteBuffer bb = ByteBuffer.allocate(2);
- bb.order(ByteOrder.BIG_ENDIAN);
- bb.put(a);
- bb.put(b);
- short result = bb.getShort(0);
- return result;
- }