### LANGUAGE: JAVA

### CHALLENGE:

If the second parameter is negative, the method returns zero. Otherwise it returns the value of the first parameter raised to the power of the second parameter.

### SOLUTION:

public double powerTo (double a, int b) { double answer = 0; while ( b >= 0) { answer = Math.pow(a, (double)b); return answer; } return 0; }