Does the following code correctly perform a liner search on an array of ints?

            for (int i=0; i < values.length; i++) { 
              if (values[i] == searchedValue){
                found = true;
              } else{ 
                found = false;
              } 
            } 
            if (found) { 
              System.out.println("found " + searchedValue); 
            } else {
              System.out.println ("not found"); 
            }     
          

No
  • Yes

There are no hints for this question