code: public static void createDirectory(File location) throws IOException {
      if (!(location.exists() || location.mkdirs() || location.isDirectory())) {
        throw new IOException("Could not create directory at " + location);
      }
    }
docs: Ensures that a directory is created in the given location, throws an IOException otherwise.