There are two ways of interpreting the "ascending" requirement. The looser interpretation is "in every list, the integers should appear in ascending order". The stricter interpretation is "the lists need to be given in order". I guess that's the one you want, but I came up with a simple iterative way to satisfy the looser requirement.
For n items, count through all n-bit numbers. If the bit corresponding to an item is there, then it's in the result list.
public static void displaySubsets(List<Integer> sortedInts) {
int n=sortedInts.size();
long combinations = 1 << n;
for (int setNumber=0; setNumber<combinations; setNumber++) {
List<Integer> aResult = new ArrayList<Integer>();
for (int digit=0; digit<n; digit++) {
if ((setNumber & (1<<digit)) > 0) {
aResult.add(sortedInts.get(digit));
}
}
System.out.println(aResult.toString()+", ");
}
}
Result for 1,2,3,4,5 is:
[],
[1],
[2],
[1, 2],
[3],
[1, 3],
[2, 3],
[1, 2, 3],
[4],
[1, 4],
[2, 4],
[1, 2, 4],
[3, 4],
[1, 3, 4],
[2, 3, 4],
[1, 2, 3, 4],
[5],
[1, 5],
[2, 5],
[1, 2, 5],
[3, 5],
[1, 3, 5],
[2, 3, 5],
[1, 2, 3, 5],
[4, 5],
[1, 4, 5],
[2, 4, 5],
[1, 2, 4, 5],
[3, 4, 5],
[1, 3, 4, 5],
[2, 3, 4, 5],
[1, 2, 3, 4, 5]
Yes, I know, I lose points for not using recursion.