VOOZH about

URL: https://www.geeksforgeeks.org/java/java-guava-intmath-checkedpowint-b-int-k-method-with-examples/

⇱ Java Guava | IntMath.checkedPow(int b, int k) method with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Java Guava | IntMath.checkedPow(int b, int k) method with Examples

Last Updated : 11 Jul, 2025
checkedPow(int b, int k) is a method of Guava's IntMath Class which accepts two parameters b and k and is used to find the k-th power of b. Syntax:
public static int checkedPow(int b, int k)
Parameters: The method accepts two parameters, b and k. The parameter b is called base which is raised to the k-th power. Return Value: This method returns the k-th power of b. Exceptions: The method checkedPow(int b, int k) throws ArithmeticException if the k-th power of b overflows in signed int arithmetic. Below examples illustrate the implementation of the above method: Example 1:
Output:
5 to the 7th power is: 78125
19 to the 4th power is: 130321
Example 2:
Comment