code: public static File createTempDir(String prefix, File directory) throws IOException {
          File tempFile = File.createTempFile(prefix, "", directory);
          if (!tempFile.delete())
              throw new IOException();
          if (!tempFile.mkdir())
              throw new IOException();
          return tempFile;
      }
docs: Create a temporary directory.
  
  @param prefix
  @param directory
  @return java.io.File temporary directory
  @throws IOException