hi

I am trying to convert byte array into int[] pixels to get ImagePixels to set in
BufferedImage.setRGB(0, 0, fWidth, fHeight, pixels, 0, fWidth);

using :
public int[] getPixelsFromImage(String imageBuffer) {

byte[] b = null;

System.out.println("Length of ImageBufStr "+imageBuffer.length());
b = imageBuffer.getBytes();
System.out.println("length of Byte Array ::"+b.length);

if (b.length > Integer.MAX_VALUE) {
System.out.println(" Value is too large");
}

int[] pixels = new int[b.length/4];

int i, j;

System.out.println(b[0] + "/" + b[1] + "/" + b[2] + "/" + b[3]);

for(i=0, j =0; i < b.length; i=i+4, j++) {

pixels[j] = (b[i] << 24) + ((b[i+1] & 0xFF) << 16)
+ ((b[i+2] & 0xFF) << 8) + (b[i+3] & 0xFF);
}
return pixels;
}

This happens in a loop.

And I get java.lang.ArrayIndexOutOfBoundsException
Please suggest some solution.
Thanks