• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Convert String into double?  RSS feed

 
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..?
 
Ranch Hand
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!