Challenges recursion (Sorted Array )

sir here is my code of this problem ,dont know why my one of test casees is getting failed

import java.util.Scanner;

public class Main {
static Scanner s=new Scanner(System.in);
public static void main(String[] args) {
int num=s.nextInt();
int[] arr=new int[num];
for(int i=0;i<num ; i++) {
arr[i] =s.nextInt();
}
for(int i= 0; i < num-1 ;i++) {
if(arr[i] -arr[i+1] == 0) {
continue;
}else {
if(arr[i]-arr[i+1] > 0 ) {
sortedDec(arr,0);
System.exit(0);
}
else{
sortedInc(arr,0);
System.exit(0);
}
}
}
System.out.print(“true”);
}

public static void sortedInc(int[] arr ,int ind) {
if(ind > arr.length -2) {
System.out.print(“true”);
return;
}
if(arr[ind] <= arr[ind+1]) {
sortedInc(arr , ind +1) ;
}else {
System.out.print(“false”);
return ;
}
}
public static void sortedDec(int[] arr ,int ind) {
if(ind > arr.length -2) {
System.out.print(“true”);
return;
}
if(arr[ind] >= arr[ind+1]) {
sortedDec(arr , ind +1) ;
}else {
System.out.print(“false”);
return ;
}
}
}

@sameeksha,
your code gives Wrong answer for the input:

Input:
3
12 -4 -5

Correct output:
false
Your output:
true

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.