Here you can find the source of pow(int base, int exp)
public static int pow(int base, int exp)
//package com.java2s; /**//from w w w. java 2s .co m * Copyright (c) 2014 Sa?l Pi?a <sauljabin@gmail.com>. * * This file is part of GeneticAlgorithm. * * GeneticAlgorithm is licensed under The MIT License. * For full copyright and license information please see the LICENSE file. */ public class Main { public static int pow(int base, int exp) { return exp == 0 ? 1 : pow(base, exp - 1) * base; } public static long pow(long base, int exp) { return exp == 0 ? 1 : pow(base, exp - 1) * base; } }