i faced with same problem previously but could not find any solution. If you are having double value starting with "0." followed by three 0's then resulting format in sysout would not be in form 0.0000XXXX but would be in format XXE+-XXX
Amit Y Desai
Joined: Dec 06, 2007
Infact there is solution
Try to use the method DecimalFormat.format(double), inherited from the class NumberFormat.
The solution above is appropriate. Basically, the default way of printing floating point numbers (double and float) is only intended for debugging, not nicely-formatted output. You should use something like a DecimalFormat to present floating-point numbers to the user.
Be aware, however, that floating-point arithmetic is not exact. This is nothing to do with Java; it's the same in all languages. Floating-point should be used where you need to store numbers with a wide range of value in a smallish, fixed amount of memory and fast computation and where approximation is acceptable.
Where you need total accuracy, you should not use floating-point. You should either use integers (int, long etc.), scaled appropriately (e.g. use an integer number of thousandths), or use the BigDecimal class. BigDecimal can represent quite a big range (not as big as floating-point), but uses much more memory than floating-point and is also slower to compute.
Currency (money) calculations are the most common example of where floating-point is inappropriate. Never use floating-point for currency. Usually, the best thing to do is to use integers, representing all amounts as the smallest unit in the currency (e.g. cents, pence).
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.