Question

Is there a binary operator in Beanshell for a logical negation ¬ (not) or a workaroung for it? e.g.

 3∧¬5 = 2
Était-ce utile?

La solution

Determine bits exclusive to the two values (not on in both). Then mask off the first value to leave the bits that are exclusive in the second value, thus showing the bits that are not in the first value.

    a = 3;
    b = 5;
    print((a ^ b) & a); // ==>2
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top