Checking to see if Array is sorted
Hi everyone, I'm new to programming & this site has helped me a lot in the past so I thought I would ask another question. I'm trying to create the method isSorted that takes an array just returns true or false if the array is in descending order. I keep getting this error on line 10 saying "isSorted(int[]) in Sort cannot be applied to (int)" I'm not sure what this means.. my approach is to get the number at the index i and compare it to the number at i + 1. Can anyone explain this to me? I appreciate any help.
Code:
class Sort {
public static boolean isSorted(int[] x) {
boolean isSorted = false;
for (int i=0; i < x.length-1; i++) {
if (x[i] < x[i+1]) {
return Sort.isSorted(x[i]); //want to continue looking through list to see if all i is less than i-1
//i get an error on this line saying "isSorted(int[]) in Sort cannot be applied to (int)"
} else if (x[i] > x[i+1]) {
return false;
} else
isSorted = true;
}
}
}