Problem upper and lower bound

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt(), arr[] = new int[n];
for(int i = 0;i<=n-1;i++){
arr[i] = cin.nextInt();
}
int t = cin.nextInt();
while(t>0){
int data = cin.nextInt(),low =0, high = n - 1, lower = -1, upper = -1, count = 0;
while(low<=high){
int mid = (low+high)/2;
if(data>arr[mid]){
low = mid + 1;
}else if(data<arr[mid]){
high = mid -1;
}else if(data == arr[mid]){
if(count == 0){
lower = mid;
}
low = mid + 1;
upper = mid;
count++;
}
}
System.out.println(lower+ " "+ upper);
t–;
}

}

}==== what’s the error in code

@AbhishekAhlawat1102 that is t-- at the last.
also try to dry run your code for

10
-1 0 1 2 3 4 6 6 7 9
3
3
6
10