Here you can find the source of pow(final int a, final int b)
Parameter | Description |
---|---|
a | a parameter |
b | a parameter |
final static public long pow(final int a, final int b)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w ww. ja v a 2s .c om*/ * Integer version of {@link Math#pow(double, double)}. * * @param a * @param b * @return */ final static public long pow(final int a, final int b) { long c = 1; for (int i = 0; i < b; ++i) c *= a; return c; } /** * Float/Integer version of {@link Math#pow(double, double)}. * * @param a * @param b * @return */ final static public float pow(final float a, final int b) { float c = 1; for (int i = 0; i < b; ++i) c *= a; return c; } /** * Double/Integer version of {@link Math#pow(double, double)}. * * @param a * @param b * @return */ final static public double pow(final double a, final int b) { double c = 1; for (int i = 0; i < b; ++i) c *= a; return c; } }