Hi,

I am getting "java.lang.ArrayIndexOutOfBoundsException" exception in my program.

Below is the code.

int ind = 0;
		for(int i = 0; i < height; i++){

			for(int j = 0; j < width; j++){

				byte a = 0;
				byte r = bytes[ind];
				byte g = bytes[ind+height*width];
				byte b = bytes[ind+height*width*2];

				int pix = 0xff000000 | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);
				//int pix = ((a << 24) + (r << 16) + (g << 8) + b);
				img.setRGB(j,i,pix);
				ind++;
               red[i][j] = (pix >>> 16) & 0xff;
                green[i][j] = (pix >>> 8) & 0xff;
                blue[i][j] = pix & 0xff;
			}
		}

The exception is not thrown when I use width = 512 and Height = 512.

But whenever I use width = 352 and Height = 288, I get the above exception.

Thanks.