Convert a number from scientific notation to decimal in JAVA -


i have problem: number showing in scientific notation if has 8 or more digits before decimal point.
there simple way convert number decimal via library or something?
began creating manual method parse out, seems overcomplicated.

any appreciated.

input example: 1.0225556677556e7 

edit: need able identify number in scientific notation

you can use numberformat accomplish goal easily.

string scientificnotation = "1.0225556677556e7"; double scientificdouble = double.parsedouble(scientificnotation); numberformat nf = new decimalformat("################################################.###########################################"); decimalstring = nf.format(scientificdouble); 

to answer you're other question matching scientific notation strings- can use regex , string.matches(). 1 isn't perfect although probability of getting false positives should low:

if(mystring.matches("-?[\\d.]+(?:e-?\\d+)?")){     //do work } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -