in computer-api/src/main/java/org/apache/hugegraph/computer/core/util/BytesUtil.java [54:75]
public static int compare(byte[] bytes1, int offset1, int length1,
byte[] bytes2, int offset2, int length2) {
Preconditions.checkNotNull(bytes1);
Preconditions.checkNotNull(bytes2);
if (bytes1 == bytes2 && offset1 == offset2 && length1 == length2) {
return 0;
}
if (length1 != length2) {
return length1 - length2;
}
int end1 = offset1 + length1;
int end2 = offset2 + length2;
for (int i = offset1, j = offset2; i < end1 && j < end2; i++, j++) {
int a = (bytes1[i] & 0xff);
int b = (bytes2[j] & 0xff);
if (a != b) {
return a - b;
}
}
return 0;
}