code: private byte[] deflateImageData(PngByteArrayOutputStream inflatedImageData, int strategy, Integer compressionLevel) throws IOException {
  		byte[] result = null;
  		int bestCompression = Deflater.BEST_COMPRESSION;
  
  		if (compressionLevel == null || compressionLevel > Deflater.BEST_COMPRESSION || compressionLevel < Deflater.NO_COMPRESSION) {
  			for (int compression = Deflater.BEST_COMPRESSION; compression > Deflater.NO_COMPRESSION; compression--) {
  				final ByteArrayOutputStream deflatedOut = deflate(inflatedImageData, strategy, compression);
  
  				if (result == null || (result.length > deflatedOut.size())) {
  					result = deflatedOut.toByteArray();
  					bestCompression = compression;
  				}
  			}
  		} else {
  			result = deflate(inflatedImageData, strategy, compressionLevel).toByteArray();
  			bestCompression = compressionLevel;
  		}
  		log.debug("Compression strategy: %s, compression level=%d, bytes=%d", strategy, bestCompression, (result == null) ? -1 : result.length);
  
  		return result;
  	}
docs: /*