how can i change this for loop to recursive in the event that if groupSize=3, n=6 will print 123 124 125 126 134 135 136 145 146 156 234 235 236 245 246 345 346 356 456
public static void printCombinations(int groupSize, int n){
    if (groupSize <=n && groupSize>0 && n>0){
            for (int i=1; i<=n; i++){
                for (int j=1; j<=i-1; j++){
                    for (int k=1; k<=j-1; k++){
                        int first = k;
                        int second = j;
                        int third = i;
                        if (i!=j && i!=k && j!=k){
                            System.out.println(first +" " + second +" "+ third);
                            }
                    }
                }   
            }
        }
    }
 
     
     
    