public static String convertGramsToPoundsAndOunces(String grams) {
double weightInKG = Double.parseDouble(grams) / 1000;
double pounds = weightInKG / 0.45359237;
double lbs = Math.floor(pounds);
double fraction = (pounds - lbs) * 16;
return String.valueOf(Math.round(lbs) + "lbs" + " " + String.format("%.1f", new BigDecimal(fraction)) + "oz");
}
サービスから取得していますが305lb 0.050469oz
、変換すると表示されます305lbs 0.1oz
が、わずか305ポンドと表示されるはずです。