File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes Convert String into double? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Convert String into double?" Watch "Convert String into double?" New topic
Author

Convert String into double?

kumar mdu
Ranch Hand

Joined: Jan 04, 2011
Posts: 59
Experts,

Im doing j2me apps, I have a string that i want to convert into double for manipulation. I have a string "49997993357",

when i convert into double like


Its not converting into double. Im getting hexaDecimal value is 4.9997993357E10.

Im getting value with scientific notation..? How do i get the correct double value from string..?

I m not able to use BigDecimal and NumberFormat of java.text package in J2Me...?

Suggest me any ideas..?

Is there any other method to convert into double value..?
Raymond Tong
Ranch Hand

Joined: Aug 15, 2010
Posts: 230
    
    2

Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

This is not a hexdecimal value, this is double value. If you're willing to see this value in readable format, you must format it.

kumar mdu
Ranch Hand

Joined: Jan 04, 2011
Posts: 59

This is not a hexdecimal value, this is double value. If you're willing to see this value in readable format, you must format it.


Thanks for your reply.

When i tried to use your code, 'DecimalFormat' is in java.text package. In J2ME, CLDC doesnot support java.text package, only CDC does.
Then, how can i solve this issue..?
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

I'd write this code snippet in J2SE just to demonstrate you the idea of formatting doubles. How to do this with j2me limitations, I don't know.
kumar mdu
Ranch Hand

Joined: Jan 04, 2011
Posts: 59
Noone came across this issue, please help me?
 
wood burning stoves
 
subject: Convert String into double?
 
Similar Threads
Formatting String as double values
difference between parsexxx() and valueOf()
Program like ATM where person enters amount in dollars and cents but program uses int for monies
Large number
JLabel1.setText error