سؤال

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