Run time error in TEST CASE 1

import java.util.*;
public class Main {

public static Boolean sorted(int arr[] , int si , Boolean ans){
// base condition
if(arr[si] >= arr.length-1)
return true ;

if(arr[si] > arr[si+1])
{
ans = false ;
return ans ;
}

if(arr[si] <= arr[si+1])
sorted(arr , si+1 , ans);

return ans ;

}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);

int n = sc.nextInt() ;
int arr[] = new int[n];

for(int i = 0 ; i < arr.length ; i++ )
arr[i] = sc.nextInt() ;
Boolean final_ans = sorted(arr , 0 , false);
System.out.println(final_ans);
}

}

WITH THIS CODE I AM GETTING A RUN TIME ERROR FOR CASE 1 COULD U PLEASE HELP ME OUT

hey @rahul1402 I have checked you are not getting run time error for any case. You are getting wrong answer so check the logic again.

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.