Assume I have to sets of numbers e.g.:

setA: 1,2,3,4

setB: 10,11,12,13,14,15,16

Now I want to get all permutations where n (e.g.2) numbers are taken from setA and m (e.g.4) numbers are taken from setB.

Does someone have an efficient algorithm (preferable implemented in Java) which allows to generate all porssible permutations?

Peter