Take a look at ArrayIndexOutOfBoundsException (Java Platform SE 7 )
to better understand what the exception means.
Next, can you find line 12 in your Java source file? Which line is it? Based on the exception the line must involve an array, and the index that is provided to access the value in the array is illegal. If you're still unsure why the index is illegal, check the length of the array by printing out the length, and/or print out the entire contents of the array.
Remember, programming is not just about writing code. It's also about debugging code. Right now you're learning how to do the latter.