code: public static boolean makeDirectory(String directory, boolean createParents) throws IOException {
          boolean created = false;
          File dir = new File(directory);
          if (createParents) {
              created = dir.mkdirs();
              if (created) {
                  log.debug("Directory created: {}", dir.getAbsolutePath());
              } else {
                  log.debug("Directory was not created: {}", dir.getAbsolutePath());
              }
          } else {
              created = dir.mkdir();
              if (created) {
                  log.debug("Directory created: {}", dir.getAbsolutePath());
              } else {
                  log.debug("Directory was not created: {}", dir.getAbsolutePath());
              }
          }
          dir = null;
          return created;
      }
docs: Create a directory. The parent directories will be created if <i>createParents</i> is passed as true.
  
  @param directory
  directory
  @param createParents
  whether to create all parents
  @return true if directory was created; false if it already existed
  @throws IOException
  if we cannot create directory