Here is some1's reply I found some time ago (Note img is of BufferedImage type) :
Code to extract pixel :
int pixel=img.getRGB(x,y);
This is the code to extract RGB values from the pixel :
red=(pixel>>16) & 0xff ;
green=(pixel>>8) & 0xff ;
blue=pixel & 0xff ;
To combine RGB values again to a pixel value :
pixel = 255<<24 | red<<16 | green<<8 | blue;
To place the pixel back on the image :
img.setRGB(x,y,pixel);