Поверните массив к изображению Java

Path is were you want your image to be saved and the color array
is the array you would like to turn into an image
just as an FYI I used this in my college NEA to test outputs for
Neural Network when trainig XOR was very cool would reccomend.

public static void writeImage(String path, int[][] color) {
	BufferedImage image = new BufferedImage(color[0].length, color.length, BufferedImage.TYPE_INT_BGR);
	for (int y = 0; y < color.length; y++) {
		for (int x = 0; x < color[0].length; x++) {
			image.setRGB(x, y, color[y][x]);
		}
	}
	File ImageFile = new File(path);
	try {
		ImageIO.write(image, "png", ImageFile);
	} catch (IOException e) {
		e.printStackTrace();
	}	
}
Ashamed Albatross