@@ -0,0 +1,1627 @@
+public class Solution %7B%0A    private List%3CList%3CInteger%3E%3E list;%0A    public List%3CList%3CInteger%3E%3E subsets(int%5B%5D nums) %7B%0A        Arrays.sort(nums);%0A        list = new ArrayList%3CList%3CInteger%3E%3E();%0A        subset(nums);%0A        return list;%0A    %7D%0A    %0A    public void subset(int%5B%5D s) %7B%0A        int%5B%5D a = new int%5Bs.length%5D;%0A        backtrack(a, 0, s);%0A    %7D%0A    %0A    /*%0A     * The first k-1 indices is stored in a, here we need to choose the kth%0A     * element;%0A     */%0A    public void backtrack(int%5B%5D a, int k, int%5B%5D s) %7B%0A        // if we reach the end;%0A        if (is_a_solution(a, k, s)) %7B%0A            process_solution(a, k, s);%0A            return;%0A        %7D%0A        %0A        int%5B%5D candidates = construct_candidates(a, k, s);%0A        // k = k + 1;%0A        for (int i = 0; i %3C candidates.length; i++) %7B%0A            a%5Bk%5D = candidates%5Bi%5D;%0A            backtrack(a, k + 1, s);%0A        %7D%0A    %7D%0A    %0A    public int%5B%5D construct_candidates(int%5B%5D a, int k, int%5B%5D s) %7B%0A        // Only two possibility exists;%0A        int%5B%5D ret = %7B 0, 1 %7D;%0A        return ret;%0A    %7D%0A    %0A    /*%0A     * Process the permutation, which is the array of the indices;%0A     */%0A    public void process_solution(int%5B%5D a, int k, int%5B%5D s) %7B%0A        List%3CInteger%3E num = new ArrayList%3CInteger%3E();%0A        for (int i = 0; i %3C s.length; i++) %7B%0A            if (a%5Bi%5D == 1) %7B%0A                num.add(s%5Bi%5D);%0A            %7D%0A        %7D%0A        // Collections.sort(num);%0A        this.list.add(num);%0A    %7D%0A    %0A    public boolean is_a_solution(int%5B%5D a, int k, int%5B%5D s) %7B%0A        // Reach the limit, which there is no element here;%0A        int n = s.length;%0A        return k == n;%0A    %7D%0A%7D%0A

Create Subsets.java