Here you can find the source of createFileForReport(Path reportDir, String filePrefix, String fileSuffix)
public static Path createFileForReport(Path reportDir, String filePrefix, String fileSuffix)
//package com.java2s; //License from project: LGPL import java.nio.file.*; public class Main { public static Path createFileForReport(Path reportDir, String filePrefix, String fileSuffix) { Path reportFile = reportDir.resolve(filePrefix + "_validation_result." + fileSuffix); for (int i = 1; Files.exists(reportFile); i++) { reportFile = reportDir.resolve(filePrefix + "(" + i + ")_validation_result." + fileSuffix); }//from w ww .j av a2s . c o m return reportFile; } }