How to solve the error in this code? It works fine on eclipse but not while submitting the assignment in the recurrsion section

import java.util.*;
public class Main
{
{
public static void main(String args[])
{
Scanner S=new Scanner(System.in);
int n;
n=S.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
{
arr[i]=S.nextInt();
}
System.out.println(isSorted(arr,0));
}
public static boolean isSorted(int arr[],int si)
{
if(si==arr.length-1)
{
return true;
}
if(arr[si]>arr[si+1])
{
return false;
}
else
{
boolean restAns=isSorted(arr,si+1);
return restAns;
}
}
}