Here you can find the source of isValidDir(String dirPath, boolean createDir)
public static boolean isValidDir(String dirPath, boolean createDir)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static boolean isValidDir(String dirPath, boolean createDir) { try {/* w ww .j a v a 2 s. c om*/ File dir = new File(dirPath); if (createDir) dir.mkdirs(); return dir.isDirectory(); } catch (Exception e) { return false; } } }