Here you can find the source of power(int x, int n)
Parameter | Description |
---|---|
x | The base |
n | The exponent |
public static int power(int x, int n)
//package com.java2s; //License from project: Open Source License public class Main { /**//from www .j a v a 2s . com * Returns x to the power n. * * @param x The base * @param n The exponent * @return x to the power n. */ public static int power(int x, int n) { return (int) (Math.pow(x, n)); } }