Find Upper And Lower Bound

what should i do in this code for checking output in
-1 -1 if i take input 3 ->2 3 10

my ouput comes for take input 5 -> 1 2 3 3 4
1 1
2 3

package Challenges_Array;

import java.util.Scanner;

public class Upper_And_Lower_Bound {

public static void main(String[] args) {
	int N;  
	Scanner sc=new Scanner(System.in);  
	System.out.print("");  
	  
	N=sc.nextInt();  

	int[] A = new int[N];  
	System.out.print("");  
	for(int i=0; i<N; i++)  
	{  
	 
	A[i]=sc.nextInt();  
	}
	System.out.print(lowerBound(A,2)+" ");
	System.out.println(upperBound(A,2)+" ");

	System.out.print(lowerBound(A,3)+" ");
	System.out.println(upperBound(A,3)+" ");
}

public static int lowerBound(int[] arr,int data) {
	int low=0,high=arr.length-1;
	int ans=-1;
	while(low<=high) {
		int mid=(low+high)/2;
		if(arr[mid]==data) {
			ans=mid;
			high=mid-1;
		}else if(data<arr[mid]) {
			high=mid-1;
		}else {
			low=mid+1;
		}
	}
	return ans;
}

public static int upperBound(int[] arr,int data) {
int low=0,high=arr.length-1;
int ans=-1;
while(low<=high) {
int mid=(low+high)/2;
if(arr[mid]==data) {
ans=mid;
low=mid+1;
}else if(data<arr[mid]) {
high=mid-1;
}else {
low=mid+1;
}
}
return ans;
}
}

your logic is correct just you have hardcoded the code. take input from the user for x each time
here: