I want to convert String "0.955000" to "0.96" using Java DecimalFormat
Here's my code snippet:
String inputVal = "0.955000";
DecimalFormat decFmt = new DecimalFormat("0.00")
decFmt.setRoundingMode(RoundingMode.HALF_UP);
String outputVal = decFmt.format(Double.valueof(inputVal));
Here I get the output value as "0.95". I was expecting output to be "0.96". Does anyone know what's wrong in my code? And is there a way, I can get "0.96" using decimal format.