From the javadoc of the
public static void sort(Object[] a)
method --
"Sorts the specified array of objects into ascending order, according to the natural ordering of its elements. All elements in the array must implement the Comparable interface. Furthermore, all elements in the array must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array)."
You can read more about it here -->
http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#sort(java.lang.Object[])
Like I said in my comments, it looks like the array you are passing to your method contains elements that do not have a natural order, i.e they do not implement the Comparable interface.
Here is a sample method declaration for you.
public <K extends Comparable<? super K>> boolean search(K[] values, K key){
}
Personally I think search is not a good method name. I think 'found' would be better.
That said, you might want to read about the Comparable interface here-->
http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html
Using generics will enforce that the array you pass to the method contains elements that have a natural total order, i.e they implement the Comparable interface.
Note also that the javadoc of the Comparable interface says the following.
"It is strongly recommended (though not required) that natural orderings be consistent with equals. This is so because sorted sets (and sorted maps) without explicit comparators behave "strangely" when they are used with elements (or keys) whose natural ordering is inconsistent with equals. In particular, such a sorted set (or sorted map) violates the general contract for set (or map), which is defined in terms of the equals method."
And hence you may also want to read about the equals and the hashCode methods. Given below is a link of the javadoc of the equals method.
http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)