docs: public static int determineSampleSize(
        final RotationOptions rotationOptions,
        @Nullable final ResizeOptions resizeOptions,
        final EncodedImage encodedImage,
        final int maxBitmapSize) {
      if (!EncodedImage.isMetaDataAvailable(encodedImage)) {
        return DEFAULT_SAMPLE_SIZE;
      }
      float ratio = determineDownsampleRatio(rotationOptions, resizeOptions, encodedImage);
      int sampleSize;
      if (encodedImage.getImageFormat() == DefaultImageFormats.JPEG) {
        sampleSize = ratioToSampleSizeJPEG(ratio);
      } else {
        sampleSize = ratioToSampleSize(ratio);
      }
  
      // Check the case when the dimension of the downsampled image is still larger than the max
      // possible dimension for an image.
      int maxDimension = Math.max(encodedImage.getHeight(), encodedImage.getWidth());
      final float computedMaxBitmapSize =
          resizeOptions != null ? resizeOptions.maxBitmapSize : maxBitmapSize;
      while (maxDimension / sampleSize > computedMaxBitmapSize) {
        if (encodedImage.getImageFormat() == DefaultImageFormats.JPEG) {
          sampleSize *= 2;
        } else {
          sampleSize++;
        }
      }
      return sampleSize;
    }