public static int calculateBSA(double height, double grams) {
double weightforBmi = convertGramsToPounds(grams);
return (int) Math.sqrt(((convertCentimeterToInches(height) * weightforBmi)/3131));
}
这里是我的代码转换厘米英寸和克到磅。BSA计算结果我零
private static double convertCentimeterToInches(double height) {
return (Math.round((height/2.54) * 100)/100);
}
public static int convertGramsToPounds(double grams) {
double gramsToPoundUnit = .00220462262;
double pounds = (grams * gramsToPoundUnit);
return (int)(Math.round(pounds * 100)/100);
}
BSA计算结果我总是Zero
。我是否正确地在BSA内部完成Math.sqrt。