How do I sort an array of string for binary search. Below I always recieve a minus number for my index instead of the correct index. Please help? If the word is not in the array -1 should be returned.
public static int binary (String [] theword, String a) {
int index = -1;
Arrays.sort(theword);
Arrays.toString(theword);
index = Arrays.binarySearch(theword, a);
return index;
}
a, and then post the output here