code: public static int compareKey(byte[] key1, byte[] key2, int length) {
          return Bytes.compareTo(key1, 0, length, key2, 0, length);
      }
docs: TODO If the given keys have different length the function will not give the right result.