Yes. Are you familiar with the java.io.File class? It contains mkdir and mkdirs methods.
Note that file I/O may be forbidden by a security manager if the directories are not inside of the web applications root directory. But you'll see soon enough if that's the case; no harm in trying first.