Java Number Power pow(final int a, final int b)

Here you can find the source of pow(final int a, final int b)

Description

pow

License

Open Source License

Declaration

public static int pow(final int a, final int b) 

Method Source Code

//package com.java2s;

public class Main {
    public static int pow(final int a, final int b) {
        if (b == 0)
            return 1;
        else if (b == 1)
            return a;
        else {/*www.  j  av a2 s.co  m*/
            int result = a;

            for (int i = 1; i < b; i++)
                result *= a;

            return result;
        }
    }
}

Related

  1. pow(double[] array, double exp)
  2. pow(double[][] x, int p)
  3. pow(final double[] values, final double exp)
  4. pow(final float a, final float b)
  5. pow(final int a, final int b)
  6. pow(final int b, final int e)
  7. pow(final long base, final long exponent)
  8. pow(float a, float b)
  9. Pow(float base, float exponent)