public static short toShort(byte hi, byte lo) {
    short s = (short) (((hi & 0xFF) << 8) | (lo & 0xFF));
    Preconditions.checkArgument(s >= 0);
    return s;
  }
Read a byte from the given stream using the read method, and throw EOFException if it returns
-1, like the implementation in {@code DataInputStream}.
<p/>
This is useful because casting the return value of read method into byte directly will make us
lose the ability to check whether there is a byte and its value is -1 or we reach EOF, as
casting int -1 to byte also returns -1.
hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/StreamUtils.java