Here you can find the source of scanForDuplicates(BufferedImage leftImage, BufferedImage[] images, int i, int[] order, int width, int height)
private static void scanForDuplicates(BufferedImage leftImage, BufferedImage[] images, int i, int[] order, int width, int height)
//package com.java2s; /*//w w w . j av a 2s.c o m * leola-live * see license.txt */ import java.awt.image.BufferedImage; public class Main { private static void scanForDuplicates(BufferedImage leftImage, BufferedImage[] images, int i, int[] order, int width, int height) { for (int j = i + 1; j < images.length; j++) { BufferedImage right = images[j]; if (right != null) { if (isDataEqual(leftImage, right, width, height)) { order[j] = i; } } } } /** * Tests to see if the data is equal * * @param left * @param right * @param width * @param height * @return */ private static boolean isDataEqual(BufferedImage left, BufferedImage right, int width, int height) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { if (left.getRGB(x, y) != right.getRGB(x, y)) { return false; } } } return true; } }