question: public static void ensureDirectory ( String ... filePaths ) { if ( filePaths != null ) { File file ; for ( String filePath : filePaths ) { file = new File ( filePath ) ; if ( file . exists ( ) && ! file . isDirectory ( ) ) { throw new IllegalArgumentException ( "Given path is not a directory: " + file . getAbsolutePath ( ) ) ; } else if ( ! file . exists ( ) ) { if ( ! file . mkdirs ( ) ) { throw new IllegalStateException ( "Could not create directory: " + file . getAbsolutePath ( ) ) ; } } } } }
target:  Ensures that the directories exist