public static int calculateBSA(double height, double grams) {
double weightforBmi = convertGramsToPounds(grams);
return (int) Math.sqrt(((convertCentimeterToInches(height) * weightforBmi) / 3131));
}
Here is my code for converting Centimeter to Inches and Grams to Pounds.
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 calculation results me always Zero
. Am i doing the Math.sqrt rightly inside BSA.