Here you can find the source of pow(int i, int pow)
public static final int pow(int i, int pow)
//package com.java2s; // {LICENSE}//from w w w .j a va 2s.co m public class Main { public static final int pow(int i, int pow) { if (pow == 0 || i == 0) return 1; int r = i; if (pow > 0) { for (int j = 0; j < pow; j++) { r *= i; } } else { for (int j = 0; j < -pow; j++) { r /= i; } } return r; } }