JAVA查找该数是否在数组中

import java.util.*;
public class ad {
	   public static void main(String args[]) {
	      int start=0,end,middle;
	      int a[] = {3,52,-532,22,123};
	      int N = a.length;
	      for(int i=0; ia[middle])
	              start=middle;
	           else if(numberN/2)                    //查找次数过多,出现重复。即停止,跳出循环
	             break;
	      }
	      if(count>N/2)
	         System.out.printf("%d不在数组中.\n",number);
	      else
	         System.out.printf("%d在数组中.\n",number);
	   }
	}


你可能感兴趣的:(JAVA查找该数是否在数组中)