Example usage for com.google.common.math IntMath checkedPow

List of usage examples for com.google.common.math IntMath checkedPow

Introduction

In this page you can find the example usage for com.google.common.math IntMath checkedPow.

Prototype

public static int checkedPow(int b, int k) 

Source Link

Document

Returns the b to the k th power, provided it does not overflow.

Usage

From source file:org.spf4j.zel.operators.IntegerOperators.java

private static Number powIntInt(final Integer a, final Number b) {
    int result;//from  w w w . jav  a 2s  . c o  m
    try {
        result = IntMath.checkedPow(a, b.intValue());
    } catch (ArithmeticException e) {
        return BigInteger.valueOf(a).pow(b.intValue());
    }
    return result;
}