Reputation: 1001
Are there any built in java methods where I can convert this "1.00E-7"
to "0.0000001"
? I am using BigDecimal
as datatype by the way.
I am really stuck in here. any help would be appreciated.
Upvotes: 3
Views: 610
Reputation: 4213
Use BigDecimal#toPlainString()
, per the documentation:
toPlainString()
- Returns a string representation of thisBigDecimal
without an exponent field.
BigDecimal's documentation lists three to*String()
methods: The regular toString()
method uses scientific notation (1.00E-7)
, while toEngineeringString()
uses engineering notation (100E-9
) and toPlainString()
uses no notation (0.000000100
).
Upvotes: 3
Reputation: 3932
BigDecimal bigD = new BigDecimal("1.00E-7");
System.out.println(bigD.toPlainString());
Upvotes: 2