Array indexes are zero based. If there are 9 elements in an array, the max index is 8 (the length-1)

You should look at using a for loop controlled by the size of the array instead of hardcoding...