I tried Math.round and String.format function to round float/double values.
1) Using Math.round function
Math.round(floatValue* 10.0) / 10.0;
For floatValue 40.55, result is 40.6 //Correct & Expected result.
For floatValue 30.05, result is 30.0 //Incorrect result. Expected result: 30.1
2) Using String.format function
String.format("%.1f", floatValue);
For floatValue 40.55 result is 40.6 //Correct & Expected result.
For floatValue 59.65 result is 59.6 //Incorrect result. Expected result: 59.7
Why same function is behaving differently for different float values.