Here you can find the source of mkdir(String name)
public static void mkdir(String name)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void mkdir(String name) { String dir_name = ""; if (name.endsWith(File.separator)) { dir_name = name;/*from w w w .j av a 2 s.com*/ } else { String s = File.separator; if (s.equals("\\")) { s = "\\\\"; name = name.replace("/", "\\"); } String[] tokens = name.split(s); if (name.startsWith(File.separator)) dir_name += File.separator; for (int i = 0; i < tokens.length - 1; ++i) { dir_name += tokens[i] + File.separator; } } File f = new File(dir_name); f.mkdirs(); } }