private int getFocusedIndex() {
    Calendar bc = getCalendar(baseDate);
    Calendar fc = getCalendar(focusDate);
    bc.set(Calendar.DAY_OF_MONTH, 1);
    int skipBefore = bc.get(Calendar.DAY_OF_WEEK) - bc.getFirstDayOfWeek();
    if (skipBefore < 0)
      skipBefore = 7 + skipBefore;
    int selDay = fc.get(Calendar.DAY_OF_MONTH);
    int maxDay = bc.getActualMaximum(Calendar.DAY_OF_MONTH);
    if (selDay > maxDay)
      selDay = maxDay;
    return skipBefore + selDay - 1;
  }
private int getFocusedIndex()