0 votes
1 view
in Java by (10.2k points)

I want to print a double value in Java without exponential form.

double dexp = 12345678;

System.out.println("dexp: "+dexp);

It shows this E notation: 1.2345678E7.

I want it to print it like this: 12345678

What is the best way to prevent this?

1 Answer

0 votes
by (46.1k points)

You can try it with DecimalFormat. With this class you are very flexible in parsing your numbers.

You can exactly set the pattern you want to use.

In your case for example:

double test = 12345678;

DecimalFormat df = new DecimalFormat("#");


System.out.println(df.format(test)); //12345678

Related questions

0 votes
1 answer
asked Aug 18, 2019 in Java by Nigam (4.1k points)
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !