### Question:
GradientHash implements ImageHash { @Override public String hash(BufferedImage image) { BufferedImage processedImage = Scalr.resize(image, FIT_EXACT, WIDTH + 1, HEIGHT, OP_GRAYSCALE); StringBuilder bitString = new StringBuilder(); for (int xIdx = 0; xIdx < WIDTH; xIdx++) { for (int yIdx = 0; yIdx < HEIGHT; yIdx++) { int currentRGB = processedImage.getRGB(xIdx, yIdx) & 0xFF; int rightRGB = processedImage.getRGB(xIdx + 1, yIdx) & 0xFF; bitString.append(currentRGB < rightRGB ? "1" : "0"); } } return HashUtil.toHex(bitString, WIDTH * HEIGHT / 4); }  @Override String hash(BufferedImage image);  }### Answer:
@Test public void testGradientHash() throws FileNotFoundException, IOException { BufferedImage image = ImageHandler.load(ResourceHelper.getResourceFile("medium_5530248040.jpg")); String hash = new GradientHash().hash(image); assertEquals("f8f9f7d4e8e6d7c0", hash); }