Use Round Function if u want to round the data

http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Math.html#round%28double%29

You can also format double to 2 digits by DecimalFormat class in java...

http://download.oracle.com/javase/1.4.2/docs/api/java/text/DecimalFormat.html

I am absolutely not an expert at this, but I think this might answer your question.

(Link was provides to me by SasseMan some time ago)

Floating point numbers are represented in binary fractions. (1/2 + 1/4 + 1/8 + 1/16 etc). You fractional value is 0.3, ie 3/10. There is no exact way to represent 3/10 using only binary fractions, so the answer has to be slightly wrong. This is true of all floating point arithmetic on all binary computers.

When using floating point you must always be aware of this, and be ready to round your output to the right number of decimal places when you print it.