这是我试图执行的代码。,在返回负值的代码上很明显,但是为什么它返回-7?我隐约理解它是基于数组的长度,但有人可以解释更多。谢谢你的帮助。
public class FindNumberFromBinary {
String myBubbleStr[] = {"Zoon","Hello","World", "Yep", "Yow", "MyData"};
public String findString() {
System.out.println(Arrays.binarySearch(myBubbleStr, "yow"));
return "";
}
public static void main(String args[]){
FindNumberFromBinary fnb= new FindNumberFromBinary();
fnb.findString();
}
}