문제

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

 3∧¬5 = 2
도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top