I'm getting an integer value for the pixel in an image using this method:
int colour = img.getRGB(x, y);
getRGB(int x, int y) return you the value of color pixel at location (x,y).
You are misinterpreting the returned value.
It is in the binary format. like 11...11010101 and that is given to you as int value.
If you want to get its value use Color class. e.g.
Color mycolor = new Color(img.getRGB(x, y));
Then you can get red, green, or blue value by using
int value will be returned by these methods in familiar format having value
0 < value < 225
int red = mycolor.getRed();
If you don't wants to use
Color class then you will need to use bitwise operations to get its value.