Java: How do I implement a method that takes 2 arrays and returns 2 arrays?
<p>Okay, here is what I want to do:</p>

<p>I want to implement a crossover method for arrays.</p>

<p>It is supposed to take 2 arrays of same size and return two new arrays that are a kind of mix of the two input arrays.
as in [a,a,a,a] [b,b,b,b] ------> [a,a,b,b] [b,b,a,a].</p>

<p>Now I wonder what would be the suggested way to do that in Java, since I cannot return more than one value.</p>

<p>My ideas are:
- returning a Collection(or array) containing both new arrays.</p>

<p>I dont really like that one because it think would result in a harder to understand code.
- avoiding the need to return two results by calling the method for each case but only getting one of the results each time.</p>

<p>I dont like that one either, because there would be no natural order about which solution should be returned. This would need to be specified, though resulting in harder to understand code.</p>

<p>Plus, this will work only for this basic case, but I will want to shuffle the array before the crossover and reverse that afterwards. I cannot do the shuffling isolated from the crossover since I wont want to actually do the operation, instead I want to use the information about the permutation while doing the crossover, which will be a more efficient way I think.</p>

<p>My question is not about the algorithm itself, but about the way to put in in a method(concerning input and output) in Java</p>
