0 votes
by (2 points)
edited

There is an array of bytes. Each byte must do the reverse of each bita.Nashel spaces of the Internet such code: int current = ~ byteArray [i] & amp; 0xff; not clear, what is done to the inverted bit operation & quot; AND & quot; with the value 255 (decimal), or 11111111 (binary). If I understand correctly, the result remains the same.

2 Answers

0 votes
by (2 points)
edited
Well, damn it, he would have taken and tested. byte a = 123; int t1 = ~ a; int t2 = ~ a & amp; 0xff; Share iztsyalo ... System.out.println (t1 + & quot;: & quot; + Integer.toBinaryString (t1)); System.out.println (t2 + & quot;: & quot; + Integer.toBinaryString (t2)); negation operation converts a type byte int type. Accordingly, all 32 bits are negated int, not only your source bayt.A operation & # 39; & amp; 0xff & # 39; It leaves only the low byte of the resulting int.https: //docs.oracle.com/javase/specs/jls/se7/html/jls ..
0 votes
by (2 points)
edited
I would like to do xor 111111
Welcome to askiry.com, where you can ask questions and receive answers from other members of the community.
...