So when I execute this code it should get the rgb number for every pixel of my screen, but for some reason when it reaches the if condition, even though the console displays the exact same rgb number it is trying to compare, nothing seem to happen
for (int i=0; i<image.getWidth()-1; i++){
x += 1;
int y = 0;
for (int j=0; j<image.getHeight()-1; j++){
y += 1;
int c = image.getRGB(x,y);
int red = (c & 0x00ff0000) >> 16;
int green = (c & 0x0000ff00) >> 8;
int blue = c & 0x000000ff;
// and the Java Color is ...
Color color = new Color(red,green,blue);
Color iron = new Color(50,26,17);
Color iron2 = new Color(7,5,16);
System.out.println(color);
if (color == iron2){
Robot move = new Robot();
move.mouseMove(x,y);
System.out.println(iron2);
}
}
}