Combination and permutation algorithms can be implemented using recursion. Maybe give something like this a shot:
Code:
public void permutations(String input, int length, String current, Set<String> answer) {
if( current.length() == length ) answer.add(current);
else {
for(int i = 0; i < input.length; i++) {
String rest = input.substring(0, i) + input.substring(i+1);
permutations(rest, lengtht, current+input.charAt(i), answer);
}
}
}
After calling permutations your set will be filled with the permutations of the given string that have the given length. I hope this helps to get started.
Bookmarks