title: Summing array values java
body: <p>I'm feeding in an array of length 8 say if trials is 100 it might be of the form 93 5 2 0 0 0 0 0, but whatever the values I have in the array I only get 0.6 back. If anyone can see if I'm making a stupid error that would be great. I've tried it with a for loop but keep getting 0.6.</p>
  
  <pre><code>static void getMetric(int[]a, int trials){
      double metric = 0;
      int i =0;
      while(i&lt;8){
          if(i==0){
              double x = (a[0] / trials) - (2 / 15);
              metric += Math.abs(x);
              i++;
          }
          else if(i&gt;0 &amp;&amp; i&lt;7){
              double x = (a[i] / trials) - 0.1;
              metric += Math.abs(x);
              i++;
          }
          else{
              double x = (a[7] / trials) - (2 / 15);
              metric += Math.abs(x);
              System.out.println(""+metric);
              i++;
          }
      }
  }
  </code></pre>