code: public static short toShort(byte[] bytes, int offset, final int length) {
      if (length != SIZEOF_SHORT || offset + length > bytes.length) {
        throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_SHORT);
      }
      short n = 0;
      n ^= bytes[offset] & 0xFF;
      n <<= 8;
      n ^= bytes[offset + 1] & 0xFF;
      return n;
    }
docs: Converts a byte array to a short value.
  @param bytes byte array
  @param offset offset into array
  @param length length, has to be {@link #SIZEOF_SHORT}
  @return the short value
  @throws IllegalArgumentException if length is not {@link #SIZEOF_SHORT}
  or if there's not enough room in the array at the offset indicated.