String、int转化为Double之后 值变化,后便会加上E7,这是因为科学计数法

我们在做数据类型转换的时候,会发现数值变化了。例

54346084 ———》5.4346084E7

这是因为转化为double之后,用科科学计数法来表示,所以感觉数值有了偏差。

String UsagesSTORAGE1 = “54346084”;
Double UsagesSTORAGE2 = Double.valueOf(UsagesSTORAGE1);
Double UsagesSTORAGE3 = Double.parseDouble(UsagesSTORAGE1 );
Integer UsagesSTORAGE4 = Integer.parseInt(UsagesSTORAGE1 );
System.out.println("UsagesSTORAGE: "+UsagesSTORAGE1);
System.out.println("UsagesSTORAGE: "+UsagesSTORAGE2);
System.out.println("UsagesSTORAGE: "+UsagesSTORAGE3);
System.out.println("UsagesSTORAGE: "+UsagesSTORAGE4);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章