• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Anyone know how to control the output in Java programming?

hollowman

Diamond Member
I have a question about controlling the output in Java.

How do you round up to 2nd decimal point in java?


For an example:

I have an answer of 11001.59914874754.....

I need an answer of 11001.60 because this is in dollar.


Any helps are appreciated. Thanks
 
java.text.NumberFormat fmt = java.text.NumberFormat.getCurrencyInstance();
System.out.println(fmt.format(11001.59914874754));
 
Originally posted by: Schrodinger
java.text.NumberFormat fmt = NumberFormat.getCurrencyInstance();
System.out.println(fmt.format(11001.59914874754));

id answer it with this if it was in the software forum.

MIKE
 
Originally posted by: nourdmrolNMT1
Originally posted by: Schrodinger
java.text.NumberFormat fmt = NumberFormat.getCurrencyInstance();
System.out.println(fmt.format(11001.59914874754));

id answer it with this if it was in the software forum.

MIKE

I have one in the software forum. Go there and answer then.😛
 
Back
Top