question: private void writeFinalResults ( String outputDir , double totalTT , double [ ] totalRouteTTs , double [ ] avgRouteTTs , int [ ] routeUsers , int numberOfStuckedAgents ) { PrintStream stream ; String filename = outputDir + "FinalResults.txt" ; try { stream = new PrintStream ( new File ( filename ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; return ; } log . info ( "Total travel time: " + totalTT ) ; String header = "total tt[s]" ; StringBuffer resultLine = new StringBuffer ( ) ; resultLine . append ( totalTT ) ; String latexFormat = "" + ( int ) totalTT ; log . info ( "Route Users: (route: #users)" ) ; for ( int routeNr = 0 ; routeNr < numberOfRoutes ; routeNr ++ ) { log . info ( "\t" + routeNr + ": " + routeUsers [ routeNr ] ) ; header += "\t#users " + routeNr ; resultLine . append ( "\t" + routeUsers [ routeNr ] ) ; latexFormat += " & " + routeUsers [ routeNr ] ; } log . info ( "Average travel times: (route: avg tt)" ) ; for ( int routeNr = 0 ; routeNr < numberOfRoutes ; routeNr ++ ) { log . info ( "\t" + routeNr + ": " + avgRouteTTs [ routeNr ] ) ; header += "\tavg tt[s] " + routeNr ; resultLine . append ( "\t" + avgRouteTTs [ routeNr ] ) ; latexFormat += " & " + ( Double . isNaN ( avgRouteTTs [ routeNr ] ) ? "-" : ( int ) avgRouteTTs [ routeNr ] ) ; } log . info ( "Number of stucked agents: " + numberOfStuckedAgents ) ; header += "\t#stucked" ; resultLine . append ( "\t" + numberOfStuckedAgents ) ; latexFormat += " \\\\" ; log . info ( "Latex format: " + latexFormat ) ; stream . println ( header ) ; stream . println ( resultLine . toString ( ) ) ; stream . close ( ) ; log . info ( "output written to " + filename ) ; }
target:  Create result file for the specific iteration (FinalResults.txt) and write some results to the console.