I'm rounding off some value when I passed these values in my round()
func, in my round func I used Math.pow
and Math.round
to achieve:
round(x,2);
round(xx,2);
float x =4.68;
float xx = 4.00;
after my round off function
public static Float round(Float value, int places) {
if (value != null) {
Float scale = (float) Math.pow(10, places);
return (Float) (Math.round(value * scale) / scale);
}
return value;
}
Output Coming:
x = 4.7
x = 4
expected Output is or REQUIREMENT IS:
x-->4.70
x-->4.00