code: public static int hammingDistance(long[] x, long[] y) {
      final int lx = x.length, ly = y.length;
      final int min = (lx < ly) ? lx : ly;
      int i = 0, h = 0;
      for(; i < min; i++) {
        h += Long.bitCount(x[i] ^ y[i]);
      }
      for(; i < lx; i++) {
        h += Long.bitCount(x[i]);
      }
      for(; i < ly; i++) {
        h += Long.bitCount(y[i]);
      }
      return h;
    }
docs: Compute the Hamming distance (Size of symmetric difference), i.e.
  {@code cardinality(a ^ b)}.
  
  @param x First vector
  @param y Second vector
  @return Cardinality of symmetric difference