public static byte[] increaseLastNonMaxByte(byte[] bytes) {
    byte[] result = Arrays.copyOf(bytes, bytes.length);
    for (int i = bytes.length - 1; i >= 0; i--) {
      byte b = bytes[i];
      if (b < Byte.MAX_VALUE) {
        result[i] = (byte) (b + 1);
        break;
      }
    }
    return result;
  }
Returns ExtendedCellScanner interface over <code>cellIterable</code> or null if
<code>cells</code> is null
hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java