Hello world, When I use the Float.parseFloat(String s) method it rounds up the value. For example 35.444 is rounded up to 35.45. For my requirements, I don't wont this to happen. Could you please tell me how to stop this rounding up values. Thank you very much....
Post by:chi Lin
, Ranch Hand
The Float.parseFloat("35.444") works as expected on my machine.
However, you can use BigDecimal from java.math package to get more precision control. BigDecimal b1 = new BigDecimal (String.valueOf(35.444)); System.out.println(b1); // prints 35.444