Bitonic subarray not working please check my code ASAP

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t!=0) {
int n = sc.nextInt();
int[] arr = new int[n];
for(int i = 0 ; i< n ;i++) {
arr[i] = sc.nextInt();
}
System.out.println(find(arr));
t–;
}

}

public static int find(int[] arr) {
	
	int  a=1, b = 1;
	//int flag = 0;
	for(int i = 0 ; i < arr.length - 1 ; i++) {
		if(arr[i] <= arr[i+1] && b==1) {
			a++;
		}
		else if(arr[i] >= arr[i+1] && a==1){
			b++;
		}
		else {
			break;
		}
	}
	if(a==arr.length || b==arr.length) {
		return arr.length;
	}
	//return 0;
	int k = 1 , flag = 0 , max = 1, t=0;
	for(int i = 0 ; i<arr.length -1 ;i++) {
		if(arr[i] <= arr[i+1]) {
			if(t==1) {
				max = Math.max(max, k);
				k=0;
				t=0;
			}
			k++;
			flag = 1;
		}
		else if(arr[i] >= arr[i+1] && flag == 1) {
			k++;
			t=1;
		}
	}
	max = Math.max(max, k);
	return max;
}
  1. Initialize inc[0] to 1 and dec[n-1] to 1
  2. Creating inc[] array
    a. Till end of the array ie, i=1 to n, if arr[i] > arr[i-1] then inc[i] = inc[i-1] + 1. else, inc[i] = 1
  3. Creating dec[] array
    a. From the end of the array ie, i = n-2 till i =0, if arr[i] > arr[i+1] then dec[i] = dec[i+1] +1 else, dec[i] = 1

see this: