title: Java: A negative index and the OR logic operator
body: <p>In the second if statement when I'm comparing values[i]  and values[secondIdx], why doesn't this cause an error seeing as secondIdx is equal to -1? </p>
  
  <pre><code>public static int getSecondMinIndex(int[] values) {
          int secondIdx = -1;
          int minIdx = getMinIndex(values);
          for (int i = 0; i &lt; values.length; i++) {
              if (i == minIdx)
                  continue;
              if (values[i] &lt; values[secondIdx] || secondIdx == -1)
                  secondIdx = i;
          }
          return secondIdx;
  }
  </code></pre>