how to get upto 2 precision float in java code example Example: java 2 decimals double res = Math.round(a * 100) / 100;