So i have this code
BigDecimal bd = new BigDecimal(i);
bd = bd.round(new MathContext(6));
double meters = bd.doubleValue();
double km = bd.doubleValue()*0.001;
double cm = bd.doubleValue()*100;
double mm = bd.doubleValue()*1000;
double miles = bd.doubleValue()*0.000621371192;
double inches = bd.doubleValue()*39.3700787;
double feet = bd.doubleValue()*3.2808399;
double yards = bd.doubleValue()*1.0936133;
double points = bd.doubleValue()*2834.64567;
So i found an example on here that told me to do it like so
BigDecimal bd = new BigDecimal(i);
bd = bd.round(new MathContext(6));
double meters = bd.doubleValue();
and thats what i tried, and it round the meters number however the inches, feet, yards and so on numbers dont get rounded. am i doing this wrong? what would be the right way to go about this?
EDIT: okay so i found something that has worked in case anyone else ever has a problem with it instead of using :
double points = bd.doubleValue()*2834.64567;
i did this:
BigDecimal points = new BigDecimal(i*2834.64567);
points = points.round(new MathContext(6));