docs: private static int getDay(Calendar cal, int dayOfWeek, int orderNum){
          int day = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
  
          cal.set(Calendar.DAY_OF_MONTH, day);
          int lastWeekday = cal.get(Calendar.DAY_OF_WEEK);
          int shift = lastWeekday >= dayOfWeek ? (lastWeekday - dayOfWeek) : (lastWeekday + 7 - dayOfWeek);
  
          //find last dayOfWeek of this month
          day -= shift;
  
          if(orderNum < 0)
              return day;
  
          cal.set(Calendar.DAY_OF_MONTH, day);
          int lastOrderNum = (cal.get(Calendar.DAY_OF_MONTH) - 1) / 7;
  
          if(orderNum >= lastOrderNum)
              return day;
  
          return day - (lastOrderNum - orderNum) * 7;
      }