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

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