File getRenameArchiveName(File archive) {
    File dir = archive.getAbsoluteFile().getParentFile();
    int previousMainId = rollingFileHandler.calcNextMainId(dir, false);
    if (previousMainId == 0) {
      previousMainId = 1;
    }
    previousMainId--;
    File result = null;
    do {
      previousMainId++;
      StringBuilder buf = new StringBuilder(archive.getPath());
      int insertIdx = buf.lastIndexOf(".");
      if (insertIdx == -1) {
        buf.append(rollingFileHandler.formatId(previousMainId))
            .append(rollingFileHandler.formatId(1));
      } else {
        buf.insert(insertIdx, rollingFileHandler.formatId(1));
        buf.insert(insertIdx, rollingFileHandler.formatId(previousMainId));
      }
      result = new File(buf.toString());
    } while (result.exists());
    return result;
  }
Modifies the desired archive file name with a main id (similar to {@link #mainArchiveId} if the
archive file's dir already contains GemFire stat archive or log files containing a main id in
the file name.

@param archive the archive file name to modify

@return the modified archive file name to use; it is modified by applying the next main id if
        any files in the dir already have a main id in the file name
geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveHandler.java