title: Summing time past 24 hours
body: <p>I have the following method to sum time:</p>
  
  <pre><code>public static String sumTime(String date1, String date2) throws ParseException {
      Calendar calendar = Calendar.getInstance();
      SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss.SSS");
  
      Date d1 = formatter.parse(date1);
      Date d2 = formatter.parse(date2);
      calendar.setTime(d2);
  
      d1 = DateUtils.addHours(d1, calendar.get(Calendar.HOUR_OF_DAY));
      d1 = DateUtils.addMinutes(d1, calendar.get(Calendar.MINUTE));
      d1 = DateUtils.addSeconds(d1, calendar.get(Calendar.SECOND));
      d1 = DateUtils.addMilliseconds(d1, calendar.get(Calendar.MILLISECOND));
  
      return formatter.format(d1);
  }
  </code></pre>
  
  <p>DateUtils is from <a href="http://commons.apache.org/lang/download_lang.cgi" rel="nofollow">Apache Commons Lang 3</a><br>
  It works quite well for what I want, unless the sum is bigger than 24 hours.</p>
  
  <p><br>For example:</p>
  
  <pre><code>String time = "00:00:00.000";
  
  try {
      for (int i = 0; i &lt; 24; i++) {
              time = sumTime(time, "01:00:00.123");
      }
  
      System.out.println(time);
  } catch (ParseException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>00:00:02.952
  </code></pre>
  
  <p>But this is what I'd like it to be:</p>
  
  <pre><code>24:00:02.952
  </code></pre>
  
  <p><br>
  Is there any (easy) way to accomplish that?<br>
  I don't mind using different libraries/methods, as long as I get the correct result.</p>
  
  <p><br>Keep in mind that time will <em>always</em> start in 00:00:00.000;</p>