OK, you're still using the shorthand.
What
|
Code:
|
for (int i : arrayOne)
{} |
Expands into is something along the lines of:
|
Code:
|
for (int a = 0; a < arrayOne.length; a++)
{
int i = arrayOne[a];
} |
(this isn't actually correct, since in reality it uses Iterators I think, but for the purposes of this explanation it'll do).
As you can see, you're 'i' isn't the index, which is "hidden" from you (it's 'a').
Now, the line:
|
Code:
|
int i = arrayOne[a]; |
is itself shorthand, since arrayOne[a] is an Integer and not an int...it expands to:
|
Code:
|
int i = arrayOne[a].intValue(); |
And this is where you're null pointer exception comes from.