Вопрос

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