omg, I feel so stupid
but,
Code:
public int maxElt(int[] ary)
{
int asdf = 0;
for( int aryIndex = 0; getSize() > aryIndex; aryIndex++)
{
if(ary[aryIndex] > ary[(aryIndex+1)])
{
asdf = ary[ ary[(aryIndex+1)] ];
}
else
{
asdf = ary[aryIndex];
}
}
return asdf;
}
the error message
Code:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at TestAry.maxElt(TestAry.java:73)
i know whats wrong it is trying to get one more then the array is, But for the life of me i can't figure out what is wrong (i think i need to sleep more)if i figure it out 10min after i post this i gonna hate myself
any help would be aprecaded, the method is supposed to return the highest value in an int array