code: public static void setDecodeFormats(Intent intent, Collection<BarcodeFormat> formats) {
      StringBuilder sb = new StringBuilder();
      for (BarcodeFormat f : formats) {
        if (sb.length() != 0) sb.append(",");
        sb.append(f.name());
      }
      String formatsStr = sb.toString();
      if (formatsStr.length() != 0) intent.putExtra(Intents.Scan.FORMATS, formatsStr);
    }
docs: Set barcode formats to scan for onto {@code Intent}.
  This setting precedes to setting by {@code #setDecodeFormats} method.
  In case that {@code formats} is empty collection, this method do nothing.
  @param intent Target intent.
  @param formats Barcode formats to scan for.