Java Number Power pow(int i, int pow)

Here you can find the source of pow(int i, int pow)

Description

pow

License

Open Source License

Declaration

public static final int pow(int i, int pow) 

Method Source Code

//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;
    }
}

Related

  1. pow(int b, int e)
  2. pow(int base, int exp)
  3. pow(int base, int exp)
  4. pow(int base, int exponent)
  5. pow(int base, int power)
  6. pow(int leftOp, int rightOp)
  7. pow(int n, int p)
  8. pow(int number, int power)
  9. pow(int value, int exp)