Here you can find the source of mkdir(File dir, boolean createDirectoryIfNotExisting)
public static void mkdir(File dir, boolean createDirectoryIfNotExisting) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; public class Main { public static void mkdir(File dir, boolean createDirectoryIfNotExisting) throws IOException { if (!dir.exists()) { if (!createDirectoryIfNotExisting) { throw new IOException("The directory " + dir.getAbsolutePath() + " does not exist."); }/* w ww . j a va 2 s . co m*/ if (!dir.mkdirs()) { throw new IOException("Could not create directory " + dir.getAbsolutePath()); } } if (!dir.isDirectory()) { throw new IOException("File " + dir + " exists and is not a directory. Unable to create directory."); } } }