title: Conditional Efficiency
body: <p>Below I have a method in which given an array of integers called num, the method returns true if 1, 2, 3 are in the array, in consecutive order. There is no problem with this program. However, the conditionals in the for loop seem a bit repetitive and tedious. Is there an easier, more efficient way to get around this? (i.e. some kind of loop?)</p>
  
  <pre><code>public boolean array123(int[] nums) {
      boolean first = false;
      for (int i = 0; i &lt;nums.length-2; i++)
      {
          if (nums[i] == 1)
          {
              if (nums[i+1] == 2)
              {
                  if (nums[i+2] == 3)
                  {
                      first = true;
                  }
              }
          }
      }
      return first;
  }
  </code></pre>