我希望将以千克为单位的重量四舍五入到2 d.p,我将如何在方法中做到这一点?
public String convertFromStoneLbsOz(){
EasyIn2 reader=new EasyIn2();
System.out.println("Please enter the weight in whole stones.");
weightInStone=reader.getInt();
System.out.println("Please enter the weight in whole pounds.");
weightInLbs=reader.getInt();
System.out.println("Please enter the weight in whole ounces.");
weightInOz=reader.getInt();
weightInKg=Math.round(weightInStone*lbPerStone*ozPerLb/ozPerKg);
return ("The weight you entered in kg is "+ weightInKg + " kg.");
}