Here you can find the source of fileDir(String folder, String folderName)
public static String fileDir(String folder, String folderName)
import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.util.ArrayList; public class Main{ /* w w w . java 2 s .c o m*/ public static String fileDir(String folder, String folderName) { String path = null; if (!FileUtil.isFileExist(folder, folderName)) { String fullPath = folder + folderName; File f = new File(fullPath); f.mkdir(); path = f.getPath(); } return path; } public static String fileDir(String filename) { String path = null; if (!FileUtil.isFileExist(filename)) { File f = new File(filename); f.mkdir(); path = f.getPath(); } return path; } public static boolean isFileExist(String folder, String fileName) { boolean bool = false; bool = new File(folder, fileName).exists(); return bool; } public static boolean isFileExist(String fileName) { boolean bool = false; bool = new File(fileName).exists(); return bool; } }