This is the snippet:
String myTime = someTime / 1e9d + ",";
someTime is derived by using System.nanoTime(). What does 1e9d do here?
This is the snippet:
String myTime = someTime / 1e9d + ",";
someTime is derived by using System.nanoTime(). What does 1e9d do here?
On
The suffix d denotes a double number. If the number wasn't treated as a floating point number, then the division would be considered an integer division, returning an integer (e.g. 3/2=1).
1e9 is simply 10^9. The conversion seems to be from nanoseconds to seconds.
--EDIT--
Ingo correctly points out that 10e9 is already evaluated by java to a double (see this part of the spec for details). Therefore the 'd' isn't needed in this case.
1e9means 10^92dmeans 2 as doublee.g.
1e9=> 1.0E910e9=> 1.0E10See also the Floating-Point Literals section of The Java™ Tutorials.