I have
double a= = 13;
double b = 6;
double c = a/b;
I want to make sure it returns in three decimals. I tried
Math.round(c); //gives me an error instead.
If you need to format the output, for example to print it or display it in a textview, use:
DecimalFormat threeDecRound = new DecimalFormat();
threeDecRound.setMaximumFractionDigits(3);
threeDecRound.setRoundingMode(RoundingMode.HALF_DOWN);
threeDecRound.format(number)