code: public static boolean confirmFormat(
        Iterable<? extends FormatConfirmable> items, boolean force,
        boolean interactive)
        throws IOException {
      for (FormatConfirmable item : items) {
        if (!(item.hasSomeJournalData() || item.hasSomeImageData()))
          continue;
        if (force) { // Don't confirm, always format.
          System.err.println(
              "Data exists in " + item + ". Formatting anyway.");
          continue;
        }
        if (!interactive) { // Don't ask - always don't format
          System.err.println(
              "Running in non-interactive mode, and data appears to exist in " +
              item + ". Not formatting.");
          return false;
        }
        if (!ToolRunner.confirmPrompt("Re-format filesystem in " + item + " ?")) {
          System.err.println("Format aborted in " + item);
          return false;
        }
      }
      
      return true;
    }
docs: Iterate over each of the {@link FormatConfirmable} objects,
  potentially checking with the user whether it should be formatted.
  
  If running in interactive mode, will prompt the user for each
  directory to allow them to format anyway. Otherwise, returns
  false, unless 'force' is specified.
  
  @param interactive prompt the user when a dir exists
  @return true if formatting should proceed
  @throws IOException if some storage cannot be accessed