java用二分法查找数组

package com.oracle.core;

public class Cz {

	public static void main(String[] args) {
		int [] array={1,2,3,4,5};
		int num=4;
		int tag=0;
		int start=0;
		int end=array.length;
		while(start<=end)
		{
			int mid=(start+end)/2;
			if(array[mid]>num)
			{
				end=mid-1;
			}
			else if(array[mid]

你可能感兴趣的:(java练习,java,二分法,查找,数组)