public final ByteBuffer putShort(int baseOffset, short value) {
      if (order == ByteOrder.BIG_ENDIAN) {
          byteArray.set(baseOffset, (byte)((value >> 8) & 0xFF));
          byteArray.set(baseOffset + 1, (byte)(value & 0xFF));
      } else {
          byteArray.set(baseOffset + 1, (byte)((value >> 8) & 0xFF));
          byteArray.set(baseOffset, (byte)(value & 0xFF));
      }
      return this;
      }
public final ByteBuffer putShort ( int baseOffset , short value ) { if ( order == ByteOrder . BIG_ENDIAN ) { byteArray . set ( baseOffset , ( byte ) ( ( value > > 8 ) & 0xFF ) ) ; byteArray . set ( baseOffset + 1 , ( byte ) ( value & 0xFF ) ) ; } else { byteArray . set ( baseOffset + 1 , ( byte ) ( ( value > > 8 ) & 0xFF ) ) ; byteArray . set ( baseOffset , ( byte ) ( value & 0xFF ) ) ; } return this ; }
Writes the given short to the specified index of this buffer.
<p> The short is converted to bytes using the current byte order. The position is not
changed. </p>

@param index the index, must not be negative and equal or less than {@code limit - 2}.
@param value the short to write.
@return this buffer.
@exception IndexOutOfBoundsException if {@code index} is invalid.
@exception ReadOnlyBufferException if no changes may be made to the contents of this buffer.