Reputation: 8487
How yto convert a value to exponential i mean
1.522222 to 152.2222e-2 and .1522222e+1 and 2
2. string s=123456789123
my s.length is greater than 9 than i have to get a value 1.234567891e+11 and the same in case 0.0123466789, now i need out put like 1.23456789e-2
Upvotes: 1
Views: 1137
Reputation: 8935
try this:
public static String fromStandartToExponent(String v){
return String.format("%e",Double.parseDouble(v));
}
See java doc for java.util.Formatter
for more formatting options
Upvotes: 1