List of utility methods to do BigInteger Power
BigInteger | pow(BigInteger base, BigInteger exponent) pow BigInteger result = BigInteger.ONE; while (exponent.signum() > 0) { if (exponent.testBit(0)) result = result.multiply(base); base = base.multiply(base); exponent = exponent.shiftRight(1); return result; ... |
BigInteger | Power(BigInteger base, int exp) Power BigInteger powerResultat = new BigInteger("1"); if (exp == 1) { return base; if (exp == 0) { return powerResultat; for (int i = 0; i < exp; ++i) { ... |
BigInteger | powerToEnergy(BigInteger power, Integer ptuDuration) Transforms a power (Watt) of a PTU to an energy (Watt hour). BigDecimal hoursPerPtu = new BigDecimal(Hours.ONE.toStandardMinutes().getMinutes()) .divide(new BigDecimal(ptuDuration), DECIMAL_PRECISION, RoundingMode.HALF_UP); return new BigDecimal(power).divide(hoursPerPtu, DECIMAL_PRECISION, RoundingMode.HALF_UP).toBigInteger(); |