I'm trying to create an image using this array: [-8421505, -8421505, -8421505, -8421505,...] its length is: 62416
BufferedImage img = new BufferedImage(166, 376, BufferedImage.TYPE_INT_RGB);
int pixels[] = new int[166 * 376];
and here is where the error should be
img.getRaster().setPixels(0, 0, 166 , 376, pixels);
then I just save it
File file = new File("new.png");
ImageIO.write(img, "png", file);
which is:
ArrayIndexOutOfBoundsException : 62416