title: convert milliseconds to seconds, minutes without rounding
body: <p>I'm trying to convert milliseconds to seconds and minutes in Java 1.4.2. I'm having trouble because my conversions are being rounded up. For example....</p>
  
  <pre><code>public String toString() {
  
      long startTime = System.currentTimeMillis();
      long endTime = System.currentTimeMillis();
      long elapsedTimeMillis = (endTime - startTime);
  
      double seconds = (double) (elapsedTimeMillis / 1000) % 60 ;
      double minutes = (double) ((elapsedTimeMillis / (1000*60)) % 60);
  
      return 
          " elapsedTime: " 
          + " milliseconds:" + elapsedTimeMillis 
          + " seconds:" + seconds 
          + " minutes:" + minutes;
  
  } 
  </code></pre>
  
  <p>This returns results like...</p>
  
  <p><em>elapsedTime:  milliseconds:1392 seconds:1.0 minutes:0.0</em> </p>
  
  <p>and </p>
  
  <p><em>elapsedTime:  milliseconds:742 seconds:0.0 minutes:0.0123667</em></p>
  
  <p>Instead I would like...</p>
  
  <p><em>elapsedTime:  milliseconds:1392 seconds:1.392 minutes:0.0232</em> </p>
  
  <p>and </p>
  
  <p><em>elapsedTime:  milliseconds:742 seconds:0.742 minutes:0.01236667</em> </p>
  
  <p>Seems like a simple question but I'm not sure what I'm doing wrong. Can someone help me with this.</p>
  
  <p>thanks</p>