code: public static short bytesToShort(byte[] bytes, int offset) {
          short result = 0x0;
          for (int i = offset; i < offset + 2; ++i) {
              result = (short) ((result) << 8);
              result |= (bytes[i] & 0x00FF);
          }
          return result;
      }
docs: A utility method to convert the short from the byte array to a short.
  
  @param bytes
  The byte array containing the short.
  @param offset
  The index at which the short is located.
  @return The short value.