【自动化__持续集成】___java___无序数组查找
一、代码如下
package com.wujianbo; public class Demo12 { public static void main(String[] args) { // TODO Auto-generated method stub Demo12 demo12= new Demo12(); int[] numbers= {23, 77, 66, 44, 88}; Boolean result= demo12.dicordNunberCheck(numbers, 99); System.out.println(result); } //无序数组的查找 public Boolean dicordNunberCheck(int[] numbers, int value) { //23,77,66,44,88 //int value= 23; Boolean isOk= false; //int[] numbers= {23, 77, 66, 44, 88}; for(int i=0; i<numbers.length; i++) { if(numbers[i] == value) { isOk= true; break; //System.out.println("您找的数存在数组中"); }else{ isOk= false; //System.out.println("您找的数不存在"); } } //System.out.println(isOk); return isOk; }