boolean (@NotNull Image img1, @NotNull Image img2, @Nullable /*OUT*/StringBuilder reason) { int[] d1 = getArgbData(img1); int[] d2 = getArgbData(img2); if (d1.length != d2.length) { if (reason != null) //noinspection StringConcatenationInsideStringBufferAppend reason.append("size mismatch: " + "[" + img1.getWidth(null) + "x" + img1.getHeight(null) + "] vs " + "[" + img2.getWidth(null) + "x" + img2.getHeight(null) + "]"); return false; } for (int i = 0; i < d1.length; i++) { if (!colorComparator.compare(d1[i], d2[i])) { int y = i / img1.getWidth(null); int x = i - y * img1.getWidth(null); if (reason != null) //noinspection StringConcatenationInsideStringBufferAppend reason.append("colors differ at [" + x + "," + y + "]; " + "0x" + Integer.toHexString(d1[i]) + " vs 0x" + Integer.toHexString(d2[i])); return false; } } return true; }