PLEASE CHECK THE CODE BELOW IT IS NOT GIVING OUTPUT***
package coding;
public class Binarysearch {
public static void main(String[] args) {
int a[]= {10,20,30,40,50,60};
System.out.println(binarySearch(a,50));
}
public static int binarySearch(int b[],int item)
{
int low=0;
int high=b.length-1;
while(low<=high)
{
int med=low+high/2;
if(item>b[med])
{
low=med+1;
}
else if(item<b[med])
{
high=med-1;
}
else
{
return med;
}
}
return -1;
}
}