public static void generate_power_set(ArrayList<Integer> S) {
        for (int i = 0; i < (1 << S.size()); ++i) {
            int x = i;
            while (x != 0) {
                int tar = (int) (Math.log(x & ~(x - 1)) / LOG_2);
                System.out.print(S.get(tar));
                if ((x &= x - 1) != 0) {
                    System.out.print(",");
                }
            }
            System.out.println();
        }
    }