Reputation: 414
i'm learn Java thourgh Android Studio with Java, i was stuck at the Float Format, how can you display, for example: 1.234E10 instead of 12340000000000, thanks guys
Upvotes: 1
Views: 295
Reputation: 159754
12340000000000
is actually 1.234E13
DecimalFormat formatter = new DecimalFormat("0.###E0");
String format = formatter.format(12340000000000.0);
System.out.println(format);
Output:
1.234E13
Upvotes: 1
Reputation: 15668
1.234E10
is actually the same as 12340000000000
only it's printed out in an engineering format and it's a hell of a lot more readable than 12340000000000
.
Upvotes: 0