just the same code as permutations2.java