Assigning variables to array
<p>I several sets of arrays. The first array contains the ID of an item (in the example below, it would be the ID of a particular animal). The second array contains the QTY of that item.</p>

<pre><code>public int[] animals;
public int[] animalsQTY
</code></pre>

<p>These are used in the following manner:</p>

<pre><code>animals[0] = 123; // ID for pig, for e.g.
animalsQTY[0] = 4; // 4 pigs
</code></pre>

<p>I load values into these arrays from a MySQL database and have several sets of the data so I don't want to write the same loading code over and over again.</p>

<p>The problem is that if I do not load a value from the database into one of these fields, it must be a default value. In a language that allows passing variables by reference, I would send the variables to be updated to the loading method:</p>

<pre><code>Sub LoadFromMySQL(ByVal TableName As String, ByRef UpdateA() As Integer, ByRef UpdateB() As Integer)
</code></pre>

<p>Then only change items in the provided arrays when a relating record is found in the MySQL database.</p>

<p>If I only had the one pair of arrays, I would do something similar to:</p>

<pre><code>results = getMySQLresults();
foreach results as result
    animals[result['slot']] = result['id'];
    animalsQTY[result['slot']] = result['qty'];
end foreach
</code></pre>

<p>Yet I have lots of arrays to update. How can I turn the above pseudocode into a Java function / method?</p>
