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 {
    /**
     * create a new photo file on store card
     * @param subFolder
     * @param ext
     * @return
     */
    public static File getNewFile(File subFolder, String ext) {
        int idx = 1;
        File file;
        do {
            file = new File(subFolder.getAbsolutePath() + String.format("/pics_%d" + ext, idx++));
        } while (file.exists());
        return file;
    }
}