double[] recPositions(int chrom) {
        //get all recPositions of the first haplotype:
        double[] recpos = new double[0];
        for (int p=0; p<getPloidy(); p++) {
            ArrayList<Double> hrecs = haplostruct[chrom][p].getRecombPos();
            int rp=0; //index to recpos
            for (int hp=0; hp<hrecs.size(); hp++) {
                //first: skip all smaller recpos items:
                while (rp<recpos.length && recpos[rp]<hrecs.get(hp)) {
                    rp++;
                }
                //if hrecs value not in recpos: insert
                if (rp>=recpos.length || recpos[rp]!=hrecs.get(hp)) {
                    double[] tmp = new double[recpos.length+1];
                    for (int i=0; i<rp; i++) {
                        tmp[i] = recpos[i];
                    }
                    tmp[rp] = hrecs.get(hp);
                    for (int i=rp; i<recpos.length; i++ ) {
                        tmp[i+1] = recpos[i];
                    }
                    recpos = tmp;
                }
                //else hrec already in recpos, do nothing
                //rc (still) points to recpos value identical to hrecs value
            }    
        }
        assert recpos[0]==popdata.getChrom(chrom).getHeadPos();
        //delete the first (headPos) position:
        double[] result = new double[recpos.length-1];
        for (int i=0; i<result.length; i++) {
            result[i] = recpos[i+1];
        }
        return result;
    }