Answer the question
In order to leave comments, you need to log in
How to deal with bitwise operations in Java?
int a = 0xFF0;
int b = 0xF0F;
int c = 0x0FF;
c = a = (a^b | a & b)^c;
System.out.println((c | a) ^ (c & a));
==
Gives a result of 0
, write me a step-by-step solution plan
as you would decide on paper, otherwise nothing is clear no matter how hard you try , in theory you need to translate from 16 to 2, but it
should be a simpler way for
a wildly long time .
I ask for your help
Answer the question
In order to leave comments, you need to log in
"I'm lazy and don't want to do anything. Do it for me." So you won't get anywhere.
Convert from 16 -> 2 just a couple of seconds or banned in Google? And there, google the principle of operation and the priority of logical operations should not be a problem
"in theory, it is necessary to translate from 16 to 2, but it's wildly long"
any sane calculator will do it for you within a couple of milliseconds
in theory, it is necessary to translate from 16 to 2, but this is wildly long
There is no need to convert anything here, here you need to look at the boolean logic.
Namely, on (c | a) ^ (c & a) . If c=a, this expression always gives 0. Since if c=a=1 then the left will be 1 and the right will be 1, then the xor operation will return 0. For 0, the left and right will be 0, xor is also 0)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question