code: public static File createTempDir() throws IllegalStateException
     {
        File baseDir = getTempDirectory();
        try
        {
           return Files.createTempDirectory(baseDir.toPath(), "tmpdir").toFile();
        }
        catch (IOException e)
        {
           throw new IllegalStateException("Error while creating temporary directory", e);
        }
     }
docs: Create a temporary directory.