### Question:
ImageLoader extends BaseImageLoader { protected int[][] toIntArrayArray(BufferedImage image) { int w = image.getWidth(), h = image.getHeight(); int[][] ret = new int[h][w]; if (image.getRaster().getNumDataElements() == 1) { Raster raster = image.getRaster(); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { ret[i][j] = raster.getSample(j, i, 0); } } } else { for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { ret[i][j] = image.getRGB(j, i); } } } return ret; } ImageLoader();  ImageLoader(long height, long width);  ImageLoader(long height, long width, long channels);  ImageLoader(long height, long width, long channels, boolean centerCropIfNeeded); INDArray asRowVector(File f); INDArray asRowVector(InputStream inputStream); INDArray asRowVector(BufferedImage image); INDArray toRaveledTensor(File file); INDArray toRaveledTensor(InputStream is); INDArray toRaveledTensor(BufferedImage image); INDArray toBgr(File file); INDArray toBgr(InputStream inputStream); INDArray toBgr(BufferedImage image); INDArray asMatrix(File f); @Override INDArray asMatrix(File f, boolean nchw); INDArray asMatrix(InputStream inputStream); @Override INDArray asMatrix(InputStream inputStream, boolean nchw); @Override org.datavec.image.data.Image asImageMatrix(File f); @Override org.datavec.image.data.Image asImageMatrix(File f, boolean nchw); @Override org.datavec.image.data.Image asImageMatrix(InputStream inputStream); @Override org.datavec.image.data.Image asImageMatrix(InputStream inputStream, boolean nchw); INDArray asMatrix(BufferedImage image); INDArray asImageMiniBatches(File f, int numMiniBatches, int numRowsPerSlice); int[] flattenedImageFromFile(File f); int[][] fromFile(File file); int[][][] fromFileMultipleChannels(File file); static BufferedImage toImage(INDArray matrix); void toBufferedImageRGB(INDArray arr, BufferedImage image); static BufferedImage toBufferedImage(Image img, int type); BufferedImage centerCropIfNeeded(BufferedImage img);  }### Answer:
@Test public void testToIntArrayArray() throws Exception { BufferedImage img = makeRandomBufferedImage(true); int w = img.getWidth(); int h = img.getHeight(); int ch = 4; ImageLoader loader = new ImageLoader(0, 0, ch); int[][] arr = loader.toIntArrayArray(img); assertEquals(h, arr.length); assertEquals(w, arr[0].length); for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { assertEquals(img.getRGB(j, i), arr[i][j]); } } }