public void onSortEnded(long time) {
        System.out.println("----------------------------");
        System.out.println("Last result: " + time + "ms");
        nbOfSimulationDone++;
        if (nbOfSimulationDone == 1) {
            average = time;
        } else {
            average = (average * (nbOfSimulationDone - 1) + time) / (nbOfSimulationDone);
        }
        System.out.println("Average: " + average + "ms");

        if (nbOfSimulationDone < nbOfSimulationWanted) {
            _observableArray.randomize();
            startSimulation();
        }

    }