将java中的指数值转换为数字格式 [英] Converting exponential value in java to a number format

查看:141
本文介绍了将java中的指数值转换为数字格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用java从e​​xcel表中读取值。当我在excel中的单元格中键入超过10个字母时,它以指数形式显示,如9.78313E + 2。但这不是我给出的真实数字。
任何人都可以帮我解决这个问题。如何使用java语言将上述指数形式转换为原始数字。

I am trying to read the values from excel sheet using java. When i type more than 10 letters in a cell in excel it is displaying in exponential form like "9.78313E+2". but this is not the real number what i given. Can any body help me out in this. How can i convert the above exponential form to original number using java language.

提前致谢

推荐答案

Double.parseDouble("9.78313E+2");

给我

978.313

有关详细信息,请参阅文档

For more info see the doc.

在您进一步查询以下内容后,如果您已输入 4256411411 ,Excel将其显示为 4.26E + 09 ,将该值放入 parseDouble()只会给你 4260000000 。如果您需要原始文件,可能需要以更全面的格式为Java程序输出Excel文件,和/或使用Java / Excel API(例如POI)查询它

Following your further queries below, if you've entered 4256411411 and Excel is presenting this as 4.26E+09, putting that value into parseDouble() will only give you 4260000000. If you want the original, perhaps you need to output the Excel file in a fuller format for your Java program, and/or query it using a Java/Excel API (e.g. POI)

这篇关于将java中的指数值转换为数字格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆