code: private static boolean isGifHeader(final byte[] imageHeaderBytes, final int headerSize) {
      if (headerSize < GIF_HEADER_LENGTH) {
        return false;
      }
      return ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, GIF_HEADER_87A) ||
          ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, GIF_HEADER_89A);
    }
docs: Checks if first headerSize bytes of imageHeaderBytes constitute a valid header for a gif image.
  Details on GIF header can be found <a href="http://www.w3.org/Graphics/GIF/spec-gif89a.txt">
  on page 7</a>
  @param imageHeaderBytes
  @param headerSize
  @return true if imageHeaderBytes is a valid header for a gif image