Here you can find the source of getTempDir(File baseDir)
public static File getTempDir(File baseDir)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.UUID; public class Main { public static File getTempDir() { return getTempDir(null); }/*from w w w.j a va 2 s.com*/ public static File getTempDir(File baseDir) { File dir = null; while (dir == null) { if (baseDir != null) { dir = new File(baseDir, UUID.randomUUID().toString()); } else { dir = new File(UUID.randomUUID().toString()); } if (dir.exists()) { dir = null; } } return dir; } }