Probably this will work for you:
public int Binary_search( String name, int l , int r )
{
int lenForSearch = name.length();
if( name.compareToIgnoreCase(AddBook.get(l).get_fname().substring(0,lenForSearch)) == 0 )
{
return l;
}
else if( l == r )return -1;
int m = ( (l+r)/2 );
if( name.compareToIgnoreCase(AddBook.get(m).get_fname().substring(0,lenForSearch)) > 0 )
{
return Binary_search( name, l , m );
}
else return Binary_search( name, m , r );
}
You've missed the return statement in the last case. In every case the code has to return an integer value if you set an integer to the return type for your function.