Is there any way to convert scientific notation to fixed notation in Java.
Currently I have got the following code:
DecimalFormat dfmt=new DecimalFormat("######:#######");
print(dfmt.format((new BigDecimal((Math.pow(10,-3)*3000),MathContext.Decimal64)).stripTrailingZero()));
The above code does converts scientific notation to fixed notation,however if the result is greater than zero the decimal place is ignored.
In the above example it prints 3; instead of 3.0
No comments:
Post a Comment