Conversion to string types from Double and Float in Java
Forums:
Double exp = 2.718281828;
String s1 = exp.toString();
//s1 is 2.718281828
String s2 = String.format("%.3f", exp);
//s2 is 2,718
String s3 = String.format("%3.2E", exp / 100);
//s3 is 2,72E-02
- Log in to post comments