Java BigDecimal Calculate calcBMI(BigDecimal lbs, BigDecimal inches)

Here you can find the source of calcBMI(BigDecimal lbs, BigDecimal inches)

Description

Calc BMI consistent with CPRS to two decimal places.

License

Apache License

Parameter

Parameter Description
lbs a parameter
inches a parameter

Declaration

public static String calcBMI(BigDecimal lbs, BigDecimal inches) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {
    /**//from   ww w  .  j  a va 2  s . c  o  m
     * Calc BMI consistent with CPRS to two decimal places.
     * @param lbs
     * @param inches
     * @return
     */
    public static String calcBMI(BigDecimal lbs, BigDecimal inches) {
        BigDecimal bmi = BigDecimal.valueOf(lbs.doubleValue() / 2.2).divide(
                BigDecimal.valueOf(inches.doubleValue() * inches.doubleValue() / 1550.0031000062), 2,
                BigDecimal.ROUND_HALF_UP);
        return bmi.toString();
    }
}

Related

  1. calcDistance(final BigDecimal x1, final BigDecimal y1, final BigDecimal x2, final BigDecimal y2)
  2. calcPercentage(int priceInCents, BigDecimal vat)
  3. calculate(BigDecimal number1, String operator, BigDecimal number2, int decimalPlaces)
  4. calculateArithmeticMean(BigDecimal[] values)