I'm attempting to create a method that checks an array for increasing elements. True should be returned if all the elements are in increasing order. I get an out-of-bounds exception when I compare arr[i+1]. Any ideas on how I can make it work.
int[] one = {1,2,3,4,5};
public static boolean isIncreasing(int[]arr)
{
boolean z = false;
for(int i=0; i<arr.length;i++)
{
if(arr[i]<arr[i+1])
{
z = true;
}
}
return z;
}