This is related to the way doubles are stored internally.
It's technically impossible to represent the number
1.11111111111111111111111111111111111111111111111111
exactly using the IEEE floating point number binary format. So you don't actually have
1.111111111111111111111111111111111111111111111111111
stored. The other problem is that the jvm will round your output to a certain number of decimal places when you want to display it, so you will need to use a formatter to specify how many decimal places you really want. That still won't guarantee that it wont round the last digit up to a 2, though, because of what I said above.
- Adam