public void writeFinalResults ( ) { printStatus ( ) ; try ( PrintStream out = new PrintStream ( ExampleHelpers . openExampleFileOuputStream ( "life-expectancies.csv" ) ) ) { for ( int i = 0 ; i < lifeSpans . length ; i ++ ) { if ( peopleCount [ i ] != 0 ) { out . println ( i + "," + ( double ) lifeSpans [ i ] / peopleCount [ i ] + "," + peopleCount [ i ] ) ; } } } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Writes the results of the processing to a file .