code: protected @Nullable String getSrcSetRenditions(@NotNull Media media, @NotNull MediaFormat mediaFormat, long @NotNull... widths) {
      StringBuilder srcset = new StringBuilder();
  
      for (long width : widths) {
        Optional<String> url = media.getRenditions().stream()
            .filter(rendition -> Ratio.matches(rendition.getRatio(), mediaFormat.getRatio())
                && rendition.getWidth() == width)
            .map(rendition -> rendition.getUrl())
            .findFirst();
        if (url.isPresent()) {
          if (srcset.length() > 0) {
            srcset.append(", ");
          }
          srcset.append(url.get()).append(" ").append(Long.toString(width)).append("w");
        }
      }
  
      if (srcset.length() > 0) {
        return srcset.toString();
      }
      else {
        return null;
      }
    }
docs: Generate srcset list from the resolved renditions for the ratio of the given media formats and the given widths.
  Widths that have no match are ignored.
  @param media Media
  @param mediaFormat Media format
  @param widths widths
  @return srcset String or null if no matching renditions found