Hi All,
Can any one help me.When I converting String to long ,It shwoing Exponent value and throwing numberformat exception.
I want out put like this 99998900001.00.

String stotal=request.getParameter("amt");
sop( stotal);
long damount=Long.parseLong(stotal);
sop( damount);
I have given input at amt 99998900001.00

stotal= 99998900001.00
throw numberformateexception
damount = 9.9998900001E10

Recommended Answers

All 3 Replies

I don't believe a Long can have decimals. You may want to use Float or Double.

you may later cast it to double which will give u the decimal part...

ie:

String s = "whatevernuber";
double d = Double.parseDouble(s);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.