What causes this ArrayIndexOutOfBoundsException with a simple "for"?
<p>Can someone tell me what's wrong with my array code? the output is correct, but there is some error showing at the bottom of the output.</p>

<pre><code>public static void main(String[] args) {
    // TODO Auto-generated method stub

    int[] number = {1,2,3,4,5};

    System.out.println("Number in ascending order: ");
    for (int x=0; x &lt; number.length; ++x)
        System.out.println(number[x]);

    lasttofirst(number);

}

public static void lasttofirst(int[] number)
{
    System.out.println("Number in descending order: ");
    for (int x=4; x&lt;number.length; --x)
        System.out.println(number [x]+ " ");
}
</code></pre>
