### Question:
ImageUtils { public static BufferedImage combineHorizontal(Imager[] imagers) { int width = 0, height = 0; boolean opaque = false; for (Imager imager : imagers) { width += imager.getWidth(); height = Math.max(height, imager.getHeight()); if (imager.getImage().getTransparency() == Transparency.OPAQUE) { opaque = true; } } BufferedImage imageNew = new BufferedImage(width, height, opaque ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB); if (opaque) { Graphics2D g = (Graphics2D) imageNew.getGraphics(); g.setBackground(Color.WHITE); g.clearRect(0, 0, width, height); } int startX = 0, startY = 0; int[] ImageArrayOne; int i = 0; for (Imager imager : imagers) { width = imager.getRealWidth(); height = imager.getRealHeight(); startX += imager.getLeft(); startY = imager.getTop(); ImageArrayOne = new int[width * height]; ImageArrayOne = imager.getImage().getRGB(0, 0, width, height, ImageArrayOne, 0, width); imageNew.setRGB(startX, startY, width, height, ImageArrayOne, 0, width); startX += width + imager.getRight(); } return imageNew; }  static void write(RenderedImage image, String fileName,
                           String extension); static void write(RenderedImage image, File file, String extension); static BufferedImage crop(InputStream inputStream, int x, int y,
                                   int width, int height); static BufferedImage crop(InputStream inputStream, int x, int y,
                                   int width, int height, String extention); static BufferedImage zoom(InputStream inputStream, double zoomRatio); static BufferedImage zoom(InputStream inputStream, double zoomRatio,
                                   String extention); static BufferedImage zoomAndCrop(InputStream inputStream,
                                          double zoomRatio, int x, int y, int width, int height,
                                          String extention); static BufferedImage cropAndZoom(InputStream inputStream, int x,
                                          int y, int width, int height, int newWidth, int newHeight,
                                          String extention); static BufferedImage combineHorizontal(Imager[] imagers); static BufferedImage combineVertical(Imager[] imagers); static BufferedImage combineHorizontal(InputStream[] imageStreams); static BufferedImage combineHorizontal(InputStream[] imageStreams, int gap); static BufferedImage combineHorizontal(BufferedImage[] images); static BufferedImage combineHorizontal(BufferedImage[] images, int gap); static BufferedImage combineVertical(InputStream[] imageStreams); static BufferedImage combineVertical(InputStream[] imageStreams, int gap); static BufferedImage combineVertical(BufferedImage[] images); static BufferedImage combineVertical(BufferedImage[] images, int gap); static BufferedImage combineMix(InputStream[] imageStreams,
                                         String mixConfig); static BufferedImage combineMix(BufferedImage[] images, String mixConfig);  }### Answer:
@Test public void combineHorizontal() throws Exception { String fileType = "jpg"; File img1 = new File(path + "01." + fileType); File img2 = new File(path + "02." + fileType); Imager[] imagers = new Imager[2]; imagers[0] = new Imager(new FileInputStream(img1), 0, 10, 0, 0); imagers[1] = new Imager(new FileInputStream(img2)); BufferedImage newImg = ImageUtils.combineHorizontal(imagers); File outFile = new File(path + "Horizontal." + fileType); ImageIO.write(newImg, fileType, outFile); }