Binary search error

i haved coded and there is no error in the code…but still, it is not printing the correct value
public class binarysearch {

public static void main(String[] args) {
	int [] array = {23,12,53,456,76,445,34,65,45,334,434,3,24,343,43,45,65};
	System.out.println(binary(array,76));
}
public static int binary(int []arr, int item)
{
	int low = 0;
	int high = arr.length-1;
	while(low<=high)
	{
		int mid = (low+high)/2;
		if(arr[mid]<item) {
			low = mid+1;}
		else if(arr[mid]>item) {
			high = mid-1;}
		else {
			return mid;}
	} 
	return -1;
}

}

Hi @chirag10,Binary search can only be applied on sorted array so first sort your array.

Hi @chirag10 as you are not responding to the thread, I am marking your doubt as resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.