code: public static void checkDirectory(File directory) {
          if (!(directory.exists() || directory.mkdirs())) {
              throw new ReportGenerationException(
                      String.format("Can't create data directory <%s>", directory.getAbsolutePath())
              );
          }
      }
docs: If directory doesn't exists try to create it.
  
  @param directory given directory to check
  @throws ReportGenerationException if can't create specified directory