I am writing an easy program the just returns true if an array is sorted else false and I keep getting an exception in eclipse and I just can\'t figure out why. I was wonder
If you want to check if the array is sorted DESC or ASC:
boolean IsSorted(float [] temp)
{
boolean result=true,result2=true;
for (int i = 0; i < temp.length-1; i++)
if (temp[i]< temp[i + 1])
result= false;
for (int i = 0; i < temp.length-1; i++)
if (temp[i] > temp[i + 1])
result2= false;
return result||result2;
}