views:

72

answers:

2

Input String: 115.0000

Output String should be like: 115.00

i used this code:

String.format("%.2f","115.0000");

i got IllegalArgumentException. What can i do now?

+8  A: 

You're submitting a string, but telling it to expect a floating point value. Remove the quotes around the number (second parameter).

Brian Knoblauch
+4  A: 
String.format("%.2f", Double.parseDouble("115.0000"));
nanda