I've created an array to store these objects.

My problem is, i'm trying to use a binary search to look for the last names of the customers (which have been sorted) and output the information associated. From what I can see, it DOES find the customer with a given last name, but it doesn't stop outputting the information associated..

public void binarySearch(String key){ int low = 0; int high = a.length - 1; while (low <= high){ int mid = (low + high) / 2; int cmp = a[mid].getLastName().compareTo(key); if (cmp == 0) System.out.println(a[mid]); else if (cmp < 0) low = mid + 1; else high = mid - 1; } }

Anyone have any ideas as to what's wrong here?