Yuppie, I translated some java stuff to awk (for sake of perversity but actually for some other practical reasons.) It can calculate the combination and/or the permutation of a vector.
Have a look at here if you need such a code or at the original java implementation.