code: public static boolean createNewDirectory(File directory) throws IOException
    {
      if(directory.exists())
        return false;
  
      if(!directory.mkdirs())
        throw new IOException("cannot create the directory: " + directory);
  
      return true;
    }
docs: Creates a new directory. This method creates automatically all the parent
  directories if necesary. Contrary to <code>File.mkdirs</code>, this method
  will fail if the directory cannot be created. The returned value is also
  different in meaning: <code>false</code> means that the directory was not
  created because it already existed as opposed to it was not created because
  we don't know.
  
  @param directory the directory to create
  @return <code>true</code> if the directory was created, <code>false</code>
  if it existed already.
  @throws IOException when there is a problem creating the directory