code: private Date[] getBeforeDays(int year, int month) {
          Calendar cal = Calendar.getInstance();
          cal.set(year, month, 1);
          int dayNum = getDayIndex(year, month, 1) - 1;
          Date[] date = new Date[dayNum];
          if (dayNum > 0)
              for (int i = 0; i < dayNum; i++) {
                  cal.add(Calendar.DAY_OF_MONTH, -1);
                  date[i] = cal.getTime();
              }
  
          return date;
      }
docs: Get date arrays before 1st day of the month in that week
  
  
  @param year the year
  @param month the month
  @return date arrays before 1st day of the month in that week