title: Checking whether an element exist in an array
body: <p>A simple Java code for checking whether an element exists in an array or not:</p>
  
  <pre><code>import java.util.Arrays;
  
  public class Main {
      static int[] numbers = {813, 907, 908, 909, 910};
  
      public static void main(String[] args) {
          int number = 907;
          //Integer number = 907; // the same thing -- it's not found.
          boolean b = Arrays.asList(numbers).contains(number);
          System.out.println(b);  // =&gt; false
      }
  }
  </code></pre>
  
  <p>1) Why doesn't it find 907 in the array?</p>
  
  <p>2) If there is a better way of doing it, go ahead and share your knowledge.</p>
  
  <p>UPDATE: </p>
  
  <p>It was said that <code>asList</code> converts your <code>int[]</code> into a <code>List&lt;int[]&gt;</code> with a single member: the original list. However, I expect the following code to give me 1, but it gives me 5:</p>
  
  <pre><code>System.out.println(Arrays.asList(numbers).size());
  </code></pre>