请问我在main中如何将参数传进去啊?

微信图片_20170406231101.png
public class BinarySearch{
    public static <T extends Comparable<? super T>> int binarySearch(T[] value, int begin, int end, T key){
        while (begin <=end){
            int mid = (begin+end)/2;
            if (key.compareTo(value[mid]) == 0){
                return mid;
            }
            if (key.compareTo(value[mid]) < 0){
                end = mid -1;
            }
            else begin = mid + 1;
        }
        return -1;
    }
    public static <T extends Comparable<? super T>> int binarySearch(T[] value,T key){
        return binarySearch(value,0,value.length-1,key);
    }

    public static void main(String arg[]){
        int[] array = {1,2,3,4,5,6,7};
        binarySearch(array,0,9,5);
    }
}
 

要回复问题请先登录注册