Answers for "how to determine if an array is sorted java"

2

check array is sorted java

boolean isSorted(int[] array) {
    for (int i = 0; i < array.length - 1; i++) {
        if (array[i] > array[i + 1])
            return false;
    }
    return true;
}
Posted by: Guest on October-05-2021

Code answers related to "how to determine if an array is sorted java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language