import java.math.BigDecimal; import java.math.MathContext; public class Java_bigdecimal_pow_example { public static void main(String args[]) { short i = 5; float d = 9; MathContext mc = new MathContext(0); mc = mc.DECIMAL32; BigDecimal live = new BigDecimal(i), tech = new BigDecimal(d); System.out.println("live object value : " + live); System.out.println("method generated result : " + live.pow(2)); System.out.println("\ntech object value : " + tech); System.out.println("method generated result : " + tech.pow(2).floatValue()); } }