public static int d(BitSet x, BitSet y) {
        if (x.size() != y.size())
            throw new IllegalArgumentException(String.format("BitSets have different length: x[%d], y[%d]", x.size(), y.size()));

        int dist = 0;
        for (int i = 0; i < x.size(); i++) {
            if (x.get(i) != y.get(i))
                dist++;
        }

        return dist;
    }
public static int d ( BitSet x , BitSet y ) { if ( x . size ( ) != y . size ( ) ) throw new IllegalArgumentException ( String . format ( "BitSets have different length: x[%d], y[%d]" , x . size ( ) , y . size ( ) ) ) ; int dist = 0 ; for ( int i = 0 ; i < x . size ( ) ; i ++ ) { if ( x . get ( i ) != y . get ( i ) ) dist ++ ; } return dist ; }
Returns Hamming distance between the two BitSets.