Saying "it doesn't work" is pretty meaningless. How doesn't it work? What does it do differently from what you expect? Why do you think that is? Do you get any exceptions? What have you tried? What worked, and what didn't work? Why didn't it work? Be specific, and post a short piece of runnable code that demonstrates the problem.
System.out.print( "Enter the item to be found " );
line = thing.readLine(); // line is a string
search_item = Integer.valueOf(line).intValue(); // convert to int
why do you want to convert it to an integer? ;/
if (search_item < a[middle]) makes no sense, because the type of a[middle] is contacts, search_item is an integer u cant compare them like you do.
you have to compare the strings! e.g. line.compareTo(a[middle].surname)
not tested and based on your code:
thing = new BufferedReader(new InputStreamReader(System.in));
int upper, lower, middle;
System.out.print("Enter the item to be found ");
String line = thing.readLine(); // line is a string
lower = 0;
upper = a.length - 1;
middle = (lower + upper) / 2;
if (line.compareTo(a[middle].surname) < 0)
upper = middle - 1;
lower = middle + 1;
} while ((!a[middle].surname.equals(line)) && (lower <= upper));
System.out.print("The item is at position " + middle);
System.out.print("This item is not found");
Thank you so much.