@Override
            public int findCommonPrefix(byte[] left, int leftOffset, int leftLength, byte[] right,
                                        int rightOffset, int rightLength) {
                final int stride = 8;
                final int minLength = Math.min(leftLength, rightLength);
                int strideLimit = minLength & ~(stride - 1);
                final long leftOffsetAdj = leftOffset + UnsafeAccess.BYTE_ARRAY_BASE_OFFSET;
                final long rightOffsetAdj = rightOffset + UnsafeAccess.BYTE_ARRAY_BASE_OFFSET;
                int result = 0;
                int i;

                for (i = 0; i < strideLimit; i += stride) {
                    long lw = HBasePlatformDependent.getLong(left, leftOffsetAdj + i);
                    long rw = HBasePlatformDependent.getLong(right, rightOffsetAdj + i);
                    if (lw != rw) {
                        if (!UnsafeAccess.LITTLE_ENDIAN) {
                            return result + (Long.numberOfLeadingZeros(lw ^ rw) / Bytes.SIZEOF_LONG);
                        } else {
                            return result + (Long.numberOfTrailingZeros(lw ^ rw) / Bytes.SIZEOF_LONG);
                        }
                    } else {
                        result += Bytes.SIZEOF_LONG;
                    }
                }

                // The epilogue to cover the last (minLength % stride) elements.
                for (; i < minLength; i++) {
                    int il = (left[leftOffset + i]);
                    int ir = (right[rightOffset + i]);
                    if (il != ir) {
                        return result;
                    } else {
                        result++;
                    }
                }

                return result;
            }
Lexicographically compare two arrays.

@param buffer1 left operand
@param buffer2 right operand
@param offset1 Where to start comparing in the left buffer
@param offset2 Where to start comparing in the right buffer
@param length1 How much to compare from the left buffer
@param length2 How much to compare from the right buffer
@return 0 if equal, < 0 if left is less than right, etc.
stroom-bytebuffer/src/main/java/stroom/bytebuffer/hbase/Bytes.java