public static boolean equals(final byte[] left, int leftOffset, int leftLen, final byte[] right,
    int rightOffset, int rightLen) {
    // short circuit case
    if (left == right && leftOffset == rightOffset && leftLen == rightLen) {
      return true;
    }
    // different lengths fast check
    if (leftLen != rightLen) {
      return false;
    }
    if (leftLen == 0) {
      return true;
    }

    // Since we're often comparing adjacent sorted data,
    // it's usual to have equal arrays except for the very last byte
    // so check that first
    if (left[leftOffset + leftLen - 1] != right[rightOffset + rightLen - 1]) return false;

    return LexicographicalComparerHolder.BEST_COMPARER.compareTo(left, leftOffset, leftLen, right,
      rightOffset, rightLen) == 0;
  }
Lexicographically determine the equality of two arrays.
@param left        left operand
@param leftOffset  offset into left operand
@param leftLen     length of left operand
@param right       right operand
@param rightOffset offset into right operand
@param rightLen    length of right operand
@return True if equal
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java