This week's book giveaway is in the Android forum. We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line! See this thread for details.

Hi,
I am trying to convert a String with value as 00000101001 to BigDecimal.
Just using the below code:
String str="00000101001 ";
BigDecimal bd= new BigDecimal (str);
after conversion to BigDecimal i am getting the value as 101001.
How can i get the exact String 00000101001 converted to BigDecimal.

Actual numbers -- whether they are BigDecmials, ints, longs, floats, bytes, or what-have-you -- never include leading zeros. They have no particular format at all: they represent an abstract mathematical concept. If you want to display leading zeros, you have to provide them yourself.

(Note that in Java, if you write an integer literal with a leading 0, it's assumed to be a number in octal (base 8!))