public class Power { public static void main(String[] args) { System.out.println(power(5.5,5)); } private static double power(double base, int exponent) { if (exponent == 0) return 1; if (exponent == 1) return base; double result = power(base, exponent >> 1); result *= result; if ((exponent & 0x1) == 1) result *= base; return result; } }