ImageUtils { public static boolean isSupportedImage(@Nullable final byte[] imageBytes) { return getImageType(imageBytes) != null; } private  ImageUtils(); static boolean isSupportedImage(@Nullable final byte[] imageBytes); @Nullable static Image createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels); @Nullable static Geolocation getGeolocation(@Nullable final byte[] imageBytes); @Nullable static ImageOrientation getOrientation(@Nullable final byte[] imageBytes); @Nullable static BufferedImage convertToBufferedImage(@Nullable final byte[] imageBytes); @Nullable static byte[] convertToJpegByteArray(@Nullable final BufferedImage image); @Nullable static ImageType getImageType(@Nullable final byte[] imageBytes);  }
@Test public void testIsSupportedImage() { Assert.assertTrue(ImageUtils.isSupportedImage(IMAGE_1)); Assert.assertTrue(ImageUtils.isSupportedImage(IMAGE_2)); Assert.assertTrue(ImageUtils.isSupportedImage(IMAGE_3)); Assert.assertTrue(ImageUtils.isSupportedImage(IMAGE_4)); Assert.assertFalse(ImageUtils.isSupportedImage(IMAGE_5)); Assert.assertTrue(ImageUtils.isSupportedImage(IMAGE_6)); Assert.assertFalse(ImageUtils.isSupportedImage(NOT_AN_IMAGE)); }