有没有一种使用 EXPONENTIAL PRECISION 打印的方法?我需要用小数字填充一些数据并在之后进行比较......
我有这样的:
(0) - Mesured estimatedTime for multithread in block: 1.4917951E16 s
(1) - Mesured estimatedTime for multithread in block: 7.531891E15 s
(2) - Mesured estimatedTime for multithread in block: 2.9287E13 s
(3) - Mesured estimatedTime for multithread in block: 3.28478435E17 s
(4) - Mesured estimatedTime for multithread in block: 6.038E12 s
我想这样打印:
(0) - Mesured estimatedTime for original in block: 0000.15595175E15 s
(1) - Mesured estimatedTime for original in block: 0007.335638E15 s
(2) - Mesured estimatedTime for original in block: 0416.66E15 s
(3) - Mesured estimatedTime for original in block: 0000.0390156852E15 s
(4) - Mesured estimatedTime for original in block: 6642.0E15 s
我知道你可以这样强制它:
// Force minimum number of digits to left and right of decimal point
formatter = new DecimalFormat("0.0E0");
s = formatter.format(-1234.567); // -1.2E3
但不知道我怎么能把它强制到Expo-Precision :((((帮助!! :/