I wrote this code for printing all sets of a String. It also prints the empty subset. Is this the right approach
public class AllSubSet {
public static void allSet(String s, String t) {
System.out.print(t + " ");
if (s.length() > 0) {
for (int i = 0; i < s.length(); i++) {
allSet(s.substring(i + 1, s.length()), t + s.charAt(i));
}
}
}
public static void main(String args[]) {
String a = "ABC";
String t = "";
allSet(a, t);
}
}