Applying permutation tests on a list in Java