code: public void formatTime(int hours, int minutes, int seconds, boolean extended, Appendable buffer) {
  
      try {
        // append hours
        String hour = String.valueOf(hours);
        if (hour.length() < 2) {
          buffer.append('0');
        }
        buffer.append(hour);
        if (extended) {
          buffer.append(':');
        }
        String minute = String.valueOf(minutes);
        // append minutes
        if (minute.length() < 2) {
          buffer.append('0');
        }
        buffer.append(minute);
        if (extended) {
          buffer.append(':');
        }
        // append seconds
        String second = String.valueOf(seconds);
        if (second.length() < 2) {
          buffer.append('0');
        }
        buffer.append(second);
      } catch (IOException e) {
        throw new IllegalStateException(e);
      }
    }
docs: @see #formatTime(Date, boolean, Appendable)
  
  @param hours are the {@link java.util.Calendar#HOUR_OF_DAY hours}.
  @param minutes are the {@link java.util.Calendar#MINUTE minutes}.
  @param seconds are the {@link java.util.Calendar#SECOND seconds}.
  @param extended if {@code false} the basic time format ("HHmmss") is used, if {@code true} the extended
  time format ("HH:mm:ss") is used.
  @param buffer is where to append the formatted date.