What is the simplest way to declare an array that has the same values as another array with one extra position?
<p>Basically if I have an array </p>

<pre><code>String[] animals = {"dog", "cat", "pig"}
</code></pre>

<p>and I want to make an array</p>

<pre><code>String[] animals2 = {"dog", "cat", "pig", x} 
</code></pre>

<p>where x is arbitrary</p>

<p>Edit:
I know that ArrayList would be preferable here, but it's for a homework assignment and it requires that I use arrays.</p>

<p>Edit again:
I know this isn't the simplest because I can't use ArrayList or Arrays but I figured out the solution:</p>

<pre><code>String[] name2 = new String[name.length + 1];
    for(int i = 0; i &lt; name.length; i++)
    {
        name2[i] = name[i];
    }
    for (int k = name2.length - 1; k &gt;= pos; k--)
    {
        name2[k] = name2[k - 1];
    }
    name2[pos - 1] = canName;
</code></pre>

<p>I needed the help to write my insertion sort, which inserts at point pos. Thanks for the help guys.</p>
