class IndividualUtils {

    public static Individual getBestIndividual(Population[] populations){
        Individual globalBest = null;
        Individual currentBest;

        if (populations != null){
            for (Population population : populations){
                currentBest = population.getBestIndividual();
                // initialize globalBest if null, else compare non-null currentBest
                if (globalBest == null){
                    globalBest = currentBest;
                } else if (currentBest != null && currentBest.getValue() < globalBest.getValue()){
                    globalBest = currentBest;
                }
            }
        }
        return globalBest;
    }

}