title: Looping through the elements in an array backwards
body: <p>Here's my code:</p>
  
  <pre><code>int myArray[]={1,2,3,4,5,6,7,8};
  
  for(int counter=myArray.length; counter &gt; 0;counter--){
      System.out.println(myArray[counter]);
  }
  </code></pre>
  
  <p>I'd like to print out the array in descending order, instead of ascending order (from the last element of the array to the first) but I just get thrown this error: </p>
  
  <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8
      at task1.main(task1.java:14)
  </code></pre>
  
  <p>Why is this happening? I was hoping that by using myArray.length to set the counter to 8, the code would just print out the 8th element of the array and then keep printing the one before that.</p>