title: For loop logic runs but doesn't make sense
body: <blockquote>
    <p><em>VisitProcedure.length equals 7</em></p>
  </blockquote>
  
  <p>So for some reason this method works how I want it to. But the logic makes no sense to me. I have an array of <em>7</em> and i want the user to type in some part of the index <em>0-6</em> and it will display the value at that index. If they type in a number thats out of bounds then it throws an exception. But this is how i read the if statement logic</p>
  
  <blockquote>
    <p>if index is less then 0 or index is greater then 6 do this 
    (p = VisitProcedure[index].getProcedure(); //displays the index</p>
  </blockquote>
  
  <p>But instead it does the opposite. When i pick <em>0-6</em> It displays the value of the array at that index. And when i do anything else its out of index. Also when i try a different logic</p>
  
  <blockquote>
    <p>if index is greater then equal to 0 and less then 7 do this</p>
  </blockquote>
  
  <p>I still run into error. But basically everything works fine it just doesnt make sense to me why.</p>
  
  <pre><code>public Procedure GetByIndex(int index)throws ArrayIndexOutOfBoundsException {
              Procedure p;
              if (index &lt; 0 || index &gt; 1 - VisitProcedure.length) { //switching 1 - to - 1 still doesnt work
                  p = VisitProcedure[index].getProcedure();
                  return p;   
              }
              else{
                  ArrayIndexOutOfBoundsException ar;
                  ar = new ArrayIndexOutOfBoundsException(); 
                  throw ar;
                  //throw new ArrayIndexOutOfBoundsException();
  
              }
          }
  </code></pre>