This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

I have a small ( or big) problem with BigDecimal. While dividing ,especilly with double values ,it`s giving the values that is rounded. Let us suppose, I have the following code.

Please post more details: I can't see how you can get 0.12 out of even the most imprecise double division of 0.1 / 1.

I tried what you describe and got 0.1000000000000000055511151231257827021181583404541015625, which is the result of imprecision in the double arithmetic. Note the difference between the two lines in this code snippet:It produces this result:

The result of dividing 0.1 by 1 in BigDecimal is 0.1000000000000000055511151231257827021181583404541015625
and if you use Strings you get 0.1

That might sort out your problem.

By the way: there is a static field ONE in the BigDecimal class which you might find useful.