Here you can find the source of createTempDirectory(String prefix)
public static synchronized File createTempDirectory(String prefix)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.Random; public class Main { public static final Random random = new Random(); /**//from w w w.j a v a 2s . c o m * Create a uniquely-named temporary directory. This does essentially the * same thing as java.nio.file.Files#createTempDirectory, which we can't * use because it's a Java 7+ feature. Many Minecraft users are still on * Java 6. */ public static synchronized File createTempDirectory(String prefix) { File baseDir = new File(System.getProperty("java.io.tmpdir")); baseDir.mkdirs(); while (true) { File tempDir = new File(baseDir, prefix + Math.abs(random.nextLong())); if (!tempDir.exists()) { if (tempDir.mkdir()) { return tempDir; } } } } }