/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package search; /** * * @author kvaradar */ public class Search { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int [] myArray = new int [100]; for (int i = 0; i < myArray.length; i++) { myArray[i] = 2*i; } System.out.println(lookUp(myArray,43)); System.out.println(lookUp(myArray,54)); System.out.println(lookUp(myArray,302)); } static boolean lookUp(int [] B, int x) { boolean found = false; for (int i = 0; i < B.length; i ++) { if (x == B[i]) { found = true; break; } } return found; } }