+ 3
someome who know what & 0xff do in the example bellow
if someone can explain what that & in the second instruction means : byte [] buffer=new bite[4]; int blue=(buffer[0]& 0xff);
4 Antworten
+ 3
thanks to you all👌
+ 1
& is bitwise AND operator.
0xff is hexadecimal number (of 255)with all 1's
buffer[0] value is bitwise AND operatored with 11111111
See here for more..
https://www.sololearn.com/learn/4072/?ref=app
+ 1
& is a bitwise operator
You can look here: https://www.sololearn.com/learn/4072/?ref=app
0xff is a hexadecimal value (= 255 in decimal)
for example: buffer[0] would be 3
00000011 (3) &
11111111 (255)
= 00000011 = 3
int blue would be 3.
But it gives you only the value for blue. A color needs values for red, green and blue (RGB).
Where did you see this code? Using class Color or class PixelWriter/PixelReader?