Errors in Java Array : <p>I know that the problem lies in the command line, but I have tried every which way to find a way to solve it, but I have completely no idea how I can fix the array to not be zero. I am still really new to arrays and have looked everywhere in my textbook on how to do this, but  the only example does not include arrays.</p>

<p>here is the error I am getting.</p>

<p>I am using Netbean</p>

<pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at arraysize.Arraysize.main(Arraysize.java:20)
</code></pre>

<p>Here is my code as well</p>

<pre><code>package arraysize;



public class Arraysize {


public static void main(String[] args) {
    int[] array = new int[ 10 ];
    for ( int counter = 0; counter &lt; array.length; counter++)
    array[counter] = Integer.parseInt(args[counter]);
   System.out.printf("%s%8s\n", "Index", "Value");

    for (int counter = 0; counter &lt; array.length; counter++)
       System.out.printf("%5d%8d\n", counter, array[counter]);


}

}
</code></pre>
