title: Fastest way to check if an array of boolean contains true
body: <p>I have an <code>array</code> of <code>boolean</code> entries:</p>
  
  <pre><code>boolean[] myBooleanArray = new boolean[24];
  </code></pre>
  
  <p>Currently i check if it contains true like so:</p>
  
  <pre><code>Arrays.asList(myBooleanArray).contains(true);
  </code></pre>
  
  <p>Is this the <i>fastest</i> way to check an array of boolean? If not, what is the fastest way to perform this check?</p>
  
  <p>EDIT:</p>
  
  <p>I timed the methods in your answers as follows by running it as an app on an Android 4.03 Samsung S2 device:</p>
  
  <pre><code>boolean[] myBooleanArray = new boolean[24];
  
  long startTime = System.nanoTime();
  suggestedMethod(myBooleanArray);
  long endTime = System.nanoTime();
  
  long duration = endTime - startTime;
  Log.i("timetest", Long.toString(duration));
  </code></pre>
  
  <p>Time ranking over five runs were, with fastest first:</p>
  
  <ol>
  <li><p>Between 5334 and 11584 ns:</p>
  
  <pre><code>for (boolean value : myBooleanArray) {
      if (value) {
          return true;
      }
  }
  return false;
  </code></pre></li>
  <li><p>Between 160542 and 171417 ns:</p>
  
  <pre><code>Arrays.asList(myBooleanArray).contains(true);
  </code></pre></li>
  <li><p>Between 191833 and 205750 ns:</p>
  
  <pre><code>Booleans.contains(myBooleanArray, true);
  </code></pre></li>
  </ol>