Does anybody know how I can round a double value to 3 significant figures like the examples on this website
http://www.purplemath.com/modules/rounding2.htm
double d = ...; BigDecimal bd = new BigDecimal(d); bd = bd.round(new MathContext(3)); double rounded = bd.doubleValue();
2.1m questions
2.1m answers
60 comments
57.0k users