extra large number rounds?

0

Good I'm wanting to perform an operation between a super large number "73789622.83" -0.0, the problem goes when ago this operation, the result gives me "7.378962283E7" as I could give a more friendly format

    
asked by 11.02.2018 в 18:20
source

1 answer

1

To do what you want, you usually use the class java.text.DecimalFormat . This has many options to format numbers and to parse formatted numbers. I show you an example using a pattern to format a decimal number.

DecimalFormat formatter = new DecimalFormat("#,##0.00");
System.out.println(formatter.format(4589659856658.9865));

The output would be the following:

4,589,659,856,658.99

I hope I can help you, but I recommend that you take a look at this class so you can see the different options it has.

    
answered by 11.02.2018 в 21:10