title: Making a copy of the Math.pow() method
body: <p>I'm making a method that's supposed to do the same as Math.pow(), but I just can't figure out how to make it possible to use double values for y and get a double value result with decimals.... Any ideas (preferably using a for-loop)? In the method below I used "x" as the base and "y" as the exponent. </p>
  
  <pre><code>public static double power(double x, double y) {
      double result = 1;
      if (y &lt;= 0)
          return 0;
      for (int count = 0; count &lt; (int)y; count++)
          result *= x;
      return result;
  }
  </code></pre>