java - Float value with 2 decimal places -
in android, value entered edittext converted float using following line of code.
float addpurchunitcostprice = float.valueof(addpurchasecostprice.gettext().tostring());
i have value of addpurchunitcostprice
2 decimal places (always). how can done?
floating-point values don't have decimal places. have binary places, , 2 incommensurable. if want decimal places have use decimal radix, i.e. bigdecimal.