public List<List<Integer>> subsets(int[] a) {
        List<List<Integer>> list = new ArrayList<>();
        boolean[] b = new boolean[a.length];
        generate(a, b, list, a.length);
        return list;
    }
This generates all subsets of given set.
src/problems/medium/SubSets.java