Answers for "program to check if an array is sorted or not in 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 "program to check if an array is sorted or not in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language