Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

public class Main {
    public static File findUnusedFilename(File saveDirectory, String name, String extension) {
        File file;
        String str = "";
        int i = 0;
        do {
            file = new File(saveDirectory, name + str + extension);
            str = Integer.toString(i++);
        } while (file.exists());

        return file;
    }
}