title: Initializing an array of doubles java
body: <p>I cannot for the life of me understand why this code isn't working. I am creating a function to evaluate a polynomial at all of the points over a given x interval, at a frequency specified by the user. My underlying Polynomial code is irrelevent to the problem. My problem is filling my array with the values I am obtaining from Horner's method.</p>
  
  <pre><code>public double[] evalAt(double s, double f, int n) {
      double[] resultArray = new double[n];
      double h =((f - s)/(n));
      if(s==f) {
          double tempResult = 0;
          for (int i = this.degree; i &gt;= 0; i--) {
              tempResult = tempResult * s + this.terms[i].getCoefficient();
          }
          resultArray[0] = tempResult;
      } else {
          int counter = 0;
          for(double i = s; i &lt;= f; i=i+h) {
              double tempResult = 0;
              for (int j = this.degree; j &gt;= 0; j--) {
                  tempResult = tempResult * i + this.terms[j].getCoefficient();
              }
              System.out.println("Counter: " + counter + " Result @ Counter: " + tempResult);
              resultArray[counter++] = tempResult;
          }
          System.out.println(resultArray[0]);
          System.out.println(resultArray[1]);
          System.out.println(resultArray[2]);
          System.out.println(resultArray[3]);
      }
      return resultArray;
  }
  </code></pre>
  
  <p>I have a <code>print</code> statement in there to show me what the values of the counter and the temporary result are. then I use the <code>resultArray['index'] = 'value';</code> syntax. When I run this, I see that the counter and the value are exactly as I want them, however when I check the array with the four <code>print</code> statements at the bottom, nothing happens. My inputs are <code>0,10,10</code>:</p>
  
  <p>Output:</p>
  
  <pre><code>Counter: 0 Result @ Counter: 0.0
  Counter: 1 Result @ Counter: 1.0
  Counter: 2 Result @ Counter: 4.0
  Counter: 3 Result @ Counter: 9.0
  Counter: 4 Result @ Counter: 16.0
  Counter: 5 Result @ Counter: 25.0
  Counter: 6 Result @ Counter: 36.0
  Counter: 7 Result @ Counter: 49.0
  Counter: 8 Result @ Counter: 64.0
  Counter: 9 Result @ Counter: 81.0
  Counter: 10 Result @ Counter: 100.0
  </code></pre>