private ArrayList generation2Array(Generation myGeneration)
 {
     ArrayList arrayGeneration = new ArrayList();
     for(int i=0;i<myGeneration._size;i++) {
         arrayGeneration.Add(myGeneration._genomArray[i]);
     }
     return arrayGeneration;
 }
 // Does calculation of WCET.
 private void calculation()
 {
     // Check if automatic or manual calculation.
     if (_automatic) {
         // Start loop and create new Generation.
         Generation myGeneration = new Generation(_aSettings.populationSize, _param, _aSettings.mutationRate, _aSettings.crossoverCount, this);
         _bestGenom = myGeneration.getBestGenom();
         do
         {
             // Call Functions in GUI to show results.
             _printResult(myGeneration, myGeneration.getBestGenom());
             // Crossover and Mutate Generation.
             myGeneration.crossover();
             myGeneration.mutate();
             // Select Genes from Generation with selected Selection Strategy & Create new Generation but use existing genoms.
             myGeneration = new Generation(_aSettings.strategy.select(generation2Array(myGeneration)), _aSettings.populationSize, _aSettings.mutationRate, _aSettings.crossoverCount, this);
             // Change bestGenom if necessary.
             if (_bestGenom.fittness < myGeneration.getBestGenom().fittness) {
                 _bestGenom = myGeneration.getBestGenom();
             }
         } while (again());
         // Finish and return Genom with WCET.
         _finishedWCET(_bestGenom);
     }
     // Do Manual calculation.
     else {
         // Create Genom.
         Genom myGenom = new Genom(_param,this);
         // Return Genom to GUI.
         _finishedManual(myGenom);
     }
 }