code: public static File createTempDirectory(String prefix, Path dir) throws IOException {
          if (prefix == null) {
              prefix = "";
          }
          final File file = generatePath(prefix, dir).toFile();
          if (!file.mkdirs()) {
              throw new IOException("Can't create dir " + file.getAbsolutePath());
          }
          return file;
      }
docs: Creates a temporary directory in the given directory, or in in the
  temporary directory if dir is {@code null}.