java - Round double value to 2 decimal digits -
this question has answer here:
- format double value in scientific notation 5 answers
- how round number n decimal places in java 28 answers
i have been working big numbers (with more 20 digits) , reason use double
. form numbers 8.653762536765e28. want display first 2 decimal digits. want 8.65e28.
i tried find formatting double values wan't able it. result getting 86537...12312.00 .
what thing approach case? how can manage digits in front of e (the base) , not whole number?
i think want achieve:
double d = 8.653762536765e28; decimalformat df = new decimalformat("0.00e0"); system.out.print(df.format(d));
Comments
Post a Comment