Mega Code Archive

 
Categories / Java / Data Type
 

Linear Searching double Arrays

class MainClass {   public static void main(String[] args) {     double[] x = { 92.3, 45.2, 6.8, -3.6, 10, 9000, -39 };     int i;     for (i = 0; i < x.length; i++)       if (x[i] == 9000)         break;     if (i == x.length)       System.out.println("Not found");     else       System.out.println("Found");   } }