package Maths;public class PowRecursion {public static void main(String[] args) {assert pow(2, 0) == Math.pow(2, 0);assert pow(0, 2) == Math.pow(0, 2);assert pow(2, 10) == Math.pow(2, 10);assert pow(10, 2) == Math.pow(10, 2);}/*** Returns the value of the first argument raised to the power of the* second argument** @param a the base.* @param b the exponent.* @return the value {@code a}<sup>{@code b}</sup>.*/public static long pow(int a, int b) {if (b == 0) {return 1;} else {return a * pow(a, b - 1);}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。