Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert String into double?

 
kumar mdu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Zandis Murāns
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Noone came across this issue, please help me?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic