Here you can find the source of mkdirs(File dir)
public static File mkdirs(File dir) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**/* w w w . ja v a2s . com*/ * Ensures that the given directory exists (if not, it's created, including all the parent directories.) * * @return * This method returns the 'dir' parameter so that the method call flows better. */ public static File mkdirs(File dir) throws IOException { if (dir.mkdirs() || dir.exists()) return dir; // following Ant <mkdir> task to avoid possible race condition. try { Thread.sleep(10); } catch (InterruptedException e) { // ignore } if (dir.mkdirs() || dir.exists()) return dir; throw new IOException("Failed to create a directory at " + dir); } }