You can also use a DecimalFormat which can produce a String representation of you value to 2 decimal points. Then parse that value back to a double/float.