code: public static String getOffsetCodeFromSchedule(Schedule schedule) {
  
  		double doubleLength = 0;
  		for(int i = 0; i < schedule.getNumberOfPeriods(); i ++) {
  			doubleLength += schedule.getPeriodLength(i);
  		}
  		doubleLength /= schedule.getNumberOfPeriods();
  
  		doubleLength *= 12;
  		int periodLength = (int) Math.round(doubleLength);
  
  
  		String offsetCode = periodLength + "M";
  		return offsetCode;
  	}
docs: Determines the offset code of a forward contract from a schedule. Rounds the average period length to full months.
  
  @param schedule The schedule.
  @return The offset code as String