private static void printAllPermutations(char[] str, int index) {
		if (index == str.length) {
			System.out.println(str);
			return;
		}
		for (int i = index; i < str.length; i++) {
			swap(str, index, i);
			printAllPermutations(str, index + 1);
			swap(str, index, i); //important! need to swap back
		}
	}