If you create a BigDecimal from a double value you should not use the contructor of BigDecimal:
double d = 0.1;
BigDecimal b = new BigDecimal(d);
Because of the floating-point arithmetic b will get something like 0.1000000000000000055511151231257827021181583404541015625 and not 0.1. You can get a better result using this:
double d = 0.1;
BigDecimal b = new BigDecimal.valueOf(d);
Now b is exactly 0.1.