You are casting things to Integer
s which will ruin any rounding. To use double
s, use a decimal point (i.e 100.0
instead of 100
). And if you want it with 6 decimals, use 1000000.0
like this:
double i2 = value * 2.23694;
i2 = Math.round(i2*1000000.0)/1000000.0;
But generally I think DecimalFormat is a more elegant solution (guessing you want it rounded only to present it):
DecimalFormat f = new DecimalFormat("##.000000");
String formattedValue = f.format(i2);