code: public static void writeShort(byte[] buf, int pos, short v) {
      checkBoundary(buf, pos, 2);
      buf[pos++] = (byte) (0xff & (v >> 8));
      buf[pos] = (byte) (0xff & v);
    }
docs: Writes a specific short value (2 bytes) to the output byte buffer at the given offset.
  
  @param buf output byte buffer
  @param pos offset into the byte buffer to write
  @param v short value to write