question: public static File createTempDir ( File dir , boolean cleanup ) throws IOException { if ( ! dir . mkdirs ( ) && ! dir . exists ( ) ) { throw new IOException ( String . format ( "Failed to create directory structure '%s'" , dir . toString ( ) ) ) ; } if ( cleanup ) { addCleanupHook ( dir . toPath ( ) ) ; } return dir ; }
target:  Create directory that is automatically cleaned up after the JVM shuts down through use of a Runtime shutdown hook.