How do I measure time elapsed in Java?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/238920/quick-question-java-system-clock">Quick question: Java system clock</a>  </p>
</blockquote>

<p>I want to have something like this:</p>

<pre><code>    public class Stream
    {
        public startTime;
        public endTime;

        public getDuration()
        {
            return startTime - endTime;
        }
    }
</code></pre>

<p>Which types to use in order to accomplish this in Java?<br/>
(Also it is important that for example if the startTime it's 23:00 and endTime 1:00 to get a duration of 2:00.)</p>
