code: public int getDurationInYears(XMLGregorianCalendar startDate, XMLGregorianCalendar endDate) {
          int startYear = startDate.getYear();
          final int dec = 12;
          if (startDate.getMonth() == dec) {
              // started in December, increase year with one
              startYear++;
          }
          int endYear = endDate.getYear();
          return endYear - startYear;
      }
docs: Determines number of years between two dates so that premium duration can
  be established.
  
  @param startDate start date of a period (e.g. date of birth of insured
  party).
  @param endDate end date (e.g. premium end date of an insurance).
  @return number of years between start and end.