title: java dividing an array by its elements
body: <p>I want to divide the elements of my array for the first element of the array, the method is working ok, but the last element is not been divided. </p>
  
  <p>I think I had to use &lt;= array.length..., but it obviously gives me an array out of bound exception. How can I achieve this without &lt;=length.  PS: the first element should not be dived/taken into consideration as it is the dividend.  My code is the following:</p>
  
  <pre><code>public class Ris
  {
      public static void main()
      {
          double[] testResult = {2.0, 3.6, 5.0, 2.0};
          for(int element = 0; element &lt; testResult.length; element++){
              if( testResult[element] &gt; testResult[0]){//excludes 1st element
                  testResult[element] = testResult[element] / testResult[0] ;// divides elements by first element 0
              }
            System.out.println(testResult[element]); 
  
          }
      }
  }
  </code></pre>