Here you can find the source of pow(double base, int exp)
public static double pow(double base, int exp)
//package com.java2s; public class Main { public static double pow(double base, int exp) { return exp == 0 ? 1 : sq(pow(base, exp / 2)) * (exp % 2 == 1 ? base : 1); }/*from w w w.j a v a 2 s . c o m*/ public static long pow(long base, int exp) { return exp == 0 ? 1 : sq(pow(base, exp / 2)) * (exp % 2 == 1 ? base : 1); } public static int pow(int base, int exp) { return exp == 0 ? 1 : sq(pow(base, exp / 2)) * (exp % 2 == 1 ? base : 1); } private static double sq(double x) { return x * x; } private static long sq(long x) { return x * x; } private static int sq(int x) { return x * x; } }