code: public static File createTempDir(String prefix) {
      File baseDir = new File(System.getProperty("java.io.tmpdir"));
      String baseName = prefix + System.currentTimeMillis() + "-";
  
      for (int counter = 0; counter < 10000; counter++) {
        File tempDir = new File(baseDir, baseName + counter);
        if (tempDir.mkdir()) {
          return tempDir;
        }
      }
      throw new IllegalStateException(
          "Failed to create directory within " + 10000 + " attempts (tried " + baseName + "0 to " + baseName + (10000 - 1)
              + ')');
    }
docs: Creates a temporary directory prefixed with <code>prefix</code>.
  
  @param prefix folder prefix
  @return temporary folder