public static void printSet(int[] set, boolean[] ifPrint, int start, int remain) {

        // if remaining elements to be processed is 0 .. then print the set
        if(remain == 0) {
            System.out.println("");
            System.out.print("{");

            for( int i=0; i< ifPrint.length; i++) {
                if(ifPrint[i]){
                    System.out.print(" " + set[i] + " ");
                }
            }
            System.out.print("}");
        } else {


            if(start+remain <= set.length ){
                // apply the backtracking thing here
                // iterate through the array
                for( int i=start; i< set.length; i++) {
                    // make sure the ith position has false on it
                    if(!ifPrint[i]) {
                        //turn on the print flag for ith position
                        ifPrint[i] = true;
                        // recurse to the next steps(meaning selecting it as a part of solution)
                        // increment the i+1th position and reduce the remaining amount  by 1
                        printSet(set,ifPrint,i+1,remain-1);
                        // again unset/unrecord like typical backtracking.. which means now i is not part of solution
                        ifPrint[i] = false;
                    }
                }
            }

        }
    }