title: Java Test element in an array
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1128723/in-java-how-can-i-test-if-an-array-contains-a-certain-value">In Java, how can I test if an Array contains a certain value?</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to do a sort of:</p>
  
  <pre><code>for(String s : myArray)
  {
      if(s is in newArray) //how do you test this? i want something like
                          //if(newArray.indexOf(s)!=-1)
      {
          //do nothing
      }
      else
      {
          //add to newArray
      }
  }
  </code></pre>
  
  <p>can someone please help?</p>