Look the code below:
image.getRGB(x,y) & 0x000000FF
When the result image.getRGB(x,y) is -16777216, the AND operation result is 0 (BLACK COLOR)
When the result image.getRGB(x,y) is -1, the AND operation result is 255 (WHITE COLOR)
My question is, if you look to my related article in Java - Understanding about image.getRGB(x,y) output in Binary term you can see the result of image.getRGB(x,y) in binary term include Alpha, Red, Green, and Blue (32 bit) but 0x000000FF is only 8-bit; for example:
image.getRGB : 1111 1111 0000 0000 0000 0000 0000 0000
0x000000FF : 1111 1111
image.getRGB & 0x000000FF : 0000 0000
Second Example :
image.getRGB : 1111 1111 1111 1111 1111 1111 1111 1111
0x000000FF : 1111 1111
image.getRGB & 0x000000FF : 1111 1111
How they compare between 8 bit of 0x00000FF with 32 bit image.getRGB so that they get result 0 or 255 like my case above?