Here you can find the source of powerOfN(Double v, int n)
public static Double powerOfN(Double v, int n)
//package com.java2s; public class Main { public static Double powerOfN(Double v, int n) { Double value = 1d;/*from ww w. j a v a 2s . c om*/ if (n == 0) { return 1d; } else if (n > 0) { for (int i = 0; i < n; i++) { value = value * v; } } else if (n < 0) { for (int i = 0; i < (0 - n); i++) { value = value / v; } } return value; } }