title: Iterating through array - java
body: <p>I was wondering if it was better to have a method for this and pass the <code>Array</code> to that method or to write it out every time I want to check if a number is in the <code>array</code>. </p>
  
  <p>For example:</p>
  
  <pre><code>public static boolean inArray(int[] array, int check) {
  
      for (int i = 0; i &lt; array.length; i++) {
          if (array[i] == check) 
              return true;
      }
  
      return false;
  }
  </code></pre>
  
  <p>Thanks for the help in advance!</p>