@Override
    public ArrayList<Integer[]> crossover(ArrayList<Integer[]> population, int size, double crossProbability) {
        int popSize = population.size();
        ArrayList<Integer[]> newPopulation = new ArrayList<>();
        Integer[] t1;
        Integer[][] t;
        for (int i = 0; newPopulation.size() < size; i = (i + 1) % popSize) {
            if (i >= popSize) {
                i = 0;
            }

            t1 = population.get(i);
            if (Math.random() < crossProbability) {
                if (isDoubleSlicedGenom) {
                    t = cross(t1, population.get((int) Math.floor(Math.random() * (popSize))), isRandomCrossPosition);
                } else {
                    t = cross2(t1, population.get((int) Math.floor(Math.random() * (popSize))), isRandomCrossPosition);
                }
                for (int j = 0; j < t.length; ++j) {
                    newPopulation.add(t[j]);
                }
            } else {
                newPopulation.add(t1);
            }
        }
        return newPopulation;
    }