public static int [] combinationsAtIndex(int m, int n, double i){
        if(!(m >= n)&&!(n >= 1))
            System.out.println("m >= n >= 1 required");
        double c=combinations(m,n);
        if(!(0 <= i)&&!(i < c))
            System.out.println("0 <= i < comb(m,n) required");
        int [] result = new int [0];
        c = c * n / m;
        for(int j=0;j<=m;j++){
            if (i < c){
                result = Utils.addToArray(result,j);
                n = n-1;
                if (n == 0)
                    break;
                c = c * n / (m-1);
            }
            else{
                i = i-c;
                c = c * (m-n) / (m-1);
            }
            m = m-1;
        }
        //assert i == 0
        return result;
    }