For this Question: Given an array <b>arr[]</b> of <b>N</b> distinct integers, check if this array is Sorted and Rotated clockwise. A sorted array is not considered sorted and rotated, i.e., there should be at least one rotation.
<b>Note:-</b>
The array can be sorted both increasingly  and decreasinglyThe first line of input contains the number of test cases T. Each test case contains 2 lines, the first line contains N, the number of elements in the array, and the second line contains N space-separated elements of the array.

<b>Constraints:</b>
1 <= T <= 50
3 <= N <= 10^3
1 <= A[i] <= 10^4



Print "<b>Yes</b>" if the given array is sorted and rotated, else Print "<b>No</b>", without Inverted commas.Sample Input:
2
4
3 4 1 2
3
1 3 2

Sample Output:
Yes
Yes

<b>Explanation:</b>
Testcase 1: The array is sorted (1, 2, 3, 4) and rotated twice (3, 4, 1, 2).
Testcase 2: The array is sorted (3, 2, 1) and rotated once (1, 3, 2)., I have written this Solution Code: import java.util.*;
import java.io.*;
import java.lang.*;

class Main {
    
    
    public static void main (String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine().trim()); //Inputting the testcases
		while(t-->0){
		    long n = Long.parseLong(br.readLine());
		    int arr[] = new int[(int)n];
		    String inputLine[] = br.readLine().trim().split("\\s+");
		    for(long i=0; i<n; i++){
		        arr[(int)i] = Integer.parseInt(inputLine[(int)i]);
		    }
		    
		    
		    
		    
		    long mini = Integer.MAX_VALUE, maxi = Integer.MIN_VALUE; 
        long max_index = 0, min_index = 0;
        for(long i=0; i<n; i++){
            if(maxi < arr[(int)i]){
                maxi = arr[(int)i];
                max_index = i;
            }
            if(mini > arr[(int)i]){
                mini = arr[(int)i];
                min_index = i;
            }
        }
        
        int flag = 0;
        if(max_index == min_index -1)
            flag = 1;
        else if(min_index == max_index - 1)
            flag = -1;
        
        if(flag == 1){
            for(long i = 1; flag==1 && i<=max_index; ++i){
                if(arr[(int)i-1] >= arr[(int)i])
                    flag = 0;
            }
            for(long i = min_index+1; flag==1 && i<n; ++i){
                if(arr[(int)i-1] >= arr[(int)i])
                    flag = 0;
            }
            if(arr[0]<=arr[(int)n-1])
                flag = 0;
        } else if(flag == -1){
            for(long i = 1; flag ==-1 && i<=min_index; ++i){
                if(arr[(int)i-1] <= arr[(int)i])
                    flag = 0;
            }
            for(long i = max_index+1; flag==-1 && i<n; ++i){
                if(arr[(int)i-1] <= arr[(int)i])
                    flag = 0;
            }
            if(arr[0]>=arr[(int)n-1])
                flag = 0;
        }
        
        if(flag == 0)
            System.out.println("No");
        else
            System.out.println("Yes");
		}
	}
}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?