public static int intersectionSize(long[] x,long[] y){
  final int lx=x.length, ly=y.length;
  final int min=(lx < ly) ? lx : ly;
  int res=0;
  for (int i=0; i < min; i++) {
    res+=Long.bitCount(x[i] & y[i]);
  }
  return res;
}

public static int intersectionSize ( long [ ] x , long [ ] y ) { final int lx = x . length , ly = y . length ; final int min = ( lx < ly ) ? lx : ly ; int res = 0 ; for ( int i = 0 ; i < min ; i ++ ) { res += Long . bitCount ( x [ i ] & y [ i ] ) ; } return res ; }
compute the intersection size of two bitsets .
