views:

51

answers:

1

Hi,

How-Not-To: http://yfrog.com/0kqvap

The chart show way too many decimal places.

how would solve this problem, or are there any solutions/approaches available? I'd straight forward calculate the needed decimals to be able to distinguish two neighboring values. It does not necessarily have to be percentages. It can also be time e.g.

thanks in regard Ronny

A: 

DecimalFormat ist what you are looking for.

DecimalFormat df = new DecimalFormat( "#,###,###,##0.00" );
double dd = 100.2397;
double dd2dec = new Double(df.format(dd)).doubleValue();