Here you can find the source of checkDirExists(File dir)
public static boolean checkDirExists(File dir)
//package com.java2s; /**// w w w .j av a2 s .c o m * Copyright (c) 2007-2010, Fintan Fairmichael, University College Dublin under the BSD licence. * See LICENCE.TXT for details. */ import java.io.File; public class Main { public static boolean checkDirExists(File dir) { if (dir.isDirectory()) { return true; } else { return dir.mkdirs(); } } public static boolean checkDirExists(String dirPath) { return checkDirExists(new File(dirPath)); } }