title: Formatting Double to print without scientific notation using DecimalFormat
body: <p>I have been reading timestamp values from sensor readings, but since they are provided in nanoseconds, I thought I would cast them to double and make the conversion. The resulting number is a 17 digit value, plus the separator.</p>
  
  <p>Trying to print it directly results in scientific notation, which I don't want, so I use a DecimalFormat class to output it to an expected value of 4 decimal places. The problem is, even though the debugger shows a number of 17 decimal digits, even after the 'doubleValue()' call, the output string shows me a number of 15 digits.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>...
  Double timestamp = (new Date().getTime()) +       // Example: 1.3552299670232847E12
              ((event.timestamp - System.nanoTime()) / 1000000D);
  DecimalFormat dfmt = new DecimalFormat("#.####");
  
  switch(event.sensor.getType()){
      case Sensor.TYPE_LINEAR_ACCELERATION:
      case Sensor.TYPE_ACCELEROMETER:
          accel = event.values.clone();
          String line = "A" + LOGSEPARATOR +              
              dfmt.format(timestamp.doubleValue()) + // Prints: 1355229967023.28
  ...
  </code></pre>
  
  <p>I thought this might be an android precision problem, but the debugger has the formatter showing the wrong precision as well. I have tested this in a local java program and both calls have the same amount of digits.</p>
  
  <p>Is this a DecimalFormat bug/limitation? Or am I doing something wrong?</p>