show 2 to 4 decimals float format code example Example: java string format .2f String.format("%.2f", 3.45);