Creates lexographically ordered permutations in Java