Java去掉科学记数法
0
直接上代码和结果
@Test
public void scientific() {
float a = 0.000012F;
System.out.println(a);
System.out.println((double) a);
System.out.println(String.valueOf(a));
System.out.println(Float.toString(a));
System.out.println(new BigDecimal(a));
System.out.println(new BigDecimal(String.valueOf(a)));
System.out.println(new BigDecimal(Float.toString(a)));
double b = 0.000012D;
System.out.println(b);
System.out.println((float) b);
System.out.println(String.valueOf(b));
System.out.println(Double.toString(b));
System.out.println(new BigDecimal(b));
System.out.println(new BigDecimal(String.valueOf(b)));
System.out.println(new BigDecimal(Double.toString(b)));
}
1.2E-5
1.2000000424450263E-5
1.2E-5
1.2E-5
0.00001200000042445026338100433349609375
0.000012
0.000012
1.2E-5
1.2E-5
1.2E-5
1.2E-5
0.0000120000000000000003040102891649354432956897653639316558837890625
0.000012
0.000012