// wanted, candidate notWanted and candidate are longs.
boolean take = ( wanted & candidate & ~( notWanted & candidate ) ) != 0;