title: Check an Array if it contains an integer in Java
body: <p>Is this possible and if so how would I do this correctly? Want to be able to check if it contains 1 and 2 and if so go on with the program.</p>
  
  <pre><code>import java.util.*;
  
  public class test
  {
      public static void main(String [] args) {
          int[] field = {1, 2};
  
          if (Arrays.asList(field).contains(1) &amp;&amp; Arrays.asList(field).contains(2)) {
              System.out.println("Hello World!");
          }
     }
  }
  </code></pre>