MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / Check_If_Sorted

Class Check_If_Sorted

Programs/Check_If_Sorted.java:3–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1package Programs;
2
3public class Check_If_Sorted {
4 public static void main(String[] args) {
5 int[] toCheck = {1, 2, 3, 5, 16, 8};
6 int pointer = 0;
7 System.out.println(checkIfSorted(toCheck, pointer));
8 }
9
10 private static boolean checkIfSorted(int[] toCheck, int pointer) {
11 if (pointer == toCheck.length - 1) {
12 return true;
13 }
14 return toCheck[pointer] < toCheck[pointer + 1] && checkIfSorted(toCheck, pointer + 1);
15 }
16}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected