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
public static boolean isSorted(int[] a) { for ( int i = 0; i < a.length - 1 ; i++ ) { if ( a[i] > a[i+1] ) return false; } return true; }
This function checks whether the array is in Ascending order or not.