title: Coding a loop of polynomial with a given X to find f(x) in Java
body: <p>So I have trouble coding a loop of a polynomial with a given x to find f(x) in java.
  To put it simply, for example, I have an array of f(x) = C[0]*x^n + C[1]*x^(n-1).......C[n]n, how would I code a loop to find f(x)  with the user's input of x?
  Attached below is my incomplete function</p>
  
  <pre><code>static double poly(double[] C, double x){
              int n=C.length-1;
              int K;
              double sum=0.0;
              //loop is supposed to go here
              return sum;
  }
  </code></pre>