title: java calculate total number of hours and minutes
body: <p>I have these set of time</p>
  
  <p>8:00 8:30 8:40 and 10:00</p>
  
  <p>what I wanted to do is to sum them </p>
  
  <p>8:00+8:30+8:40+10:00=35:10</p>
  
  <p>is it possible to display or print a time greater than 24hrs?</p>
  
  <p>it returns back to 0</p>
  
  <pre><code>private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) {                                             
      String[] timeInAM;
      String[] timeOutAM;
      String[] timeInPM;
      String[] timeOutPM;
      Calendar time;
      for(int i=0;i&lt;tblWorkPeriod.getRowCount();i++)
      {
          timeInAM=tblWorkPeriod.getValueAt(i, 1).toString().split(":");
          timeOutAM=tblWorkPeriod.getValueAt(i, 2).toString().split(":");
          timeInPM=tblWorkPeriod.getValueAt(i, 3).toString().split(":");
          timeOutPM=tblWorkPeriod.getValueAt(i, 4).toString().split(":");
          LocalTime inAM=new LocalTime(Integer.valueOf(timeInAM[0]),Integer.valueOf(timeInAM[1]));
          LocalTime outAM=new LocalTime(Integer.valueOf(timeOutAM[0]),Integer.valueOf(timeOutAM[1]));
          LocalTime inPM=new LocalTime(Integer.valueOf(timeInPM[0]),Integer.valueOf(timeInPM[1]));
          LocalTime outPM=new LocalTime(Integer.valueOf(timeOutPM[0]),Integer.valueOf(timeOutPM[1]));
  
          LocalTime intervalAM=outAM.minusHours(inAM.getHourOfDay()).minusMinutes(inAM.getMinuteOfHour());
          LocalTime intervalPM=outPM.minusHours(inPM.getHourOfDay()).minusMinutes(inPM.getMinuteOfHour());
          LocalTime total = intervalAM.plusHours(intervalPM.getHourOfDay()).plusMinutes(intervalPM.getMinuteOfHour());
  
          tblWorkPeriod.setValueAt(total.toString().substring(0, total.toString().lastIndexOf(":")),i,5);
      }
      LocalTime total=new LocalTime(0,0);
      for(int i=0;i&lt;tblWorkPeriod.getRowCount()-1;i++)
      {
          String[] strSubtotal=tblWorkPeriod.getValueAt(i, 5).toString().split(":");
          LocalTime subtotal=new LocalTime(Integer.valueOf(strSubtotal[0]),Integer.valueOf(strSubtotal[1]));
          total=total.plusHours(subtotal.getHourOfDay()).plusMinutes(subtotal.getMinuteOfHour());
      }
  
  
  }   
  </code></pre>