static void createDirectory(final String directory) throws IOException {
  File dir=new File(directory);
  if (!dir.exists()) {
    if (!dir.mkdirs()) {
      throw new IOException("Failed to create directory: " + directory);
    }
  }
}

static void createDirectory ( final String directory ) throws IOException { File dir = new File ( directory ) ; if ( ! dir . exists ( ) ) { if ( ! dir . mkdirs ( ) ) { throw new IOException ( "Failed to create directory: " + directory ) ; } } }
creates a directory unless it already exists .
