@Override
    public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
      int a1 = (short) (readUnsignedShort(b1, s1));
      int a2 = (short) (readUnsignedShort(b2, s2));
      return a1 - a2;
    }
Compare the buffers in serialized form.
serde/src/java/org/apache/hadoop/hive/serde2/io/ShortWritable.java