JJunior
JJunior

Reputation: 2849

computing scientific numbers in java

I am trying to add different numbers from a file in java.

Numbers can be of format : "1.13206e+06"

How can I parse this number to reflect actual value in java??

Thanks

Upvotes: 2

Views: 233

Answers (2)

Devon_C_Miller
Devon_C_Miller

Reputation: 16528

You want to look at Double.parseDouble

Upvotes: 3

Jon Skeet
Jon Skeet

Reputation: 1502196

You can use Double.parseDouble:

double d = Double.parseDouble("1.13206e+06");

This works fine with scientific notation.

Upvotes: 5

Related Questions