public static boolean equals(final byte[] left, final byte[] right) {
    // Could use Arrays.equals?
    // noinspection SimplifiableConditionalExpression
    if (left == right) return true;
    if (left == null || right == null) return false;
    if (left.length != right.length) return false;
    if (left.length == 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[left.length - 1] != right[right.length - 1]) return false;

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