public static KeyValue createFirstOnRow(byte[] buffer, final int boffset, final byte[] row,
    final int roffset, final int rlength, final byte[] family, final int foffset, final int flength,
    final byte[] qualifier, final int qoffset, final int qlength) throws IllegalArgumentException {

    long lLength = KeyValue.getKeyValueDataStructureSize(rlength, flength, qlength, 0);

    if (lLength > Integer.MAX_VALUE) {
      throw new IllegalArgumentException("KeyValue length " + lLength + " > " + Integer.MAX_VALUE);
    }
    int iLength = (int) lLength;
    if (buffer.length - boffset < iLength) {
      throw new IllegalArgumentException(
        "Buffer size " + (buffer.length - boffset) + " < " + iLength);
    }

    int len = KeyValue.writeByteArray(buffer, boffset, row, roffset, rlength, family, foffset,
      flength, qualifier, qoffset, qlength, HConstants.LATEST_TIMESTAMP, KeyValue.Type.Maximum,
      null, 0, 0, null);
    return new KeyValue(buffer, boffset, len);
  }
Create a KeyValue for the specified row, family and qualifier that would be smaller than all
other possible KeyValues that have the same row, family, qualifier. Used for seeking.
@param buffer    the buffer to use for the new <code>KeyValue</code> object
@param boffset   buffer offset
@param row       the value key
@param roffset   row offset
@param rlength   row length
@param family    family name
@param foffset   family offset
@param flength   family length
@param qualifier column qualifier
@param qoffset   qualifier offset
@param qlength   qualifier length
@return First possible key on passed Row, Family, Qualifier.
@throws IllegalArgumentException The resulting <code>KeyValue</code> object would be larger
                                 than the provided buffer or than
                                 <code>Integer.MAX_VALUE</code>
hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java