private Date [ ] getAfterDays ( int year , int month ) { Calendar cal = Calendar . getInstance ( ) ; cal . set ( Calendar . YEAR , year ) ; cal . set ( Calendar . MONTH , month ) ; int dayNum = cal . getActualMaximum ( Calendar . DAY_OF_MONTH ) ; cal . set ( year , month , dayNum ) ; int afterDayNum = 7 - getDayIndex ( year , month , dayNum ) ; Date [ ] date = new Date [ afterDayNum ] ; if ( afterDayNum > 0 ) for ( int i = 0 ; i < afterDayNum ; i ++ ) { cal . add ( Calendar . DAY_OF_MONTH , 1 ) ; date [ i ] = cal . getTime ( ) ; } return date ; }
Get date arrays after the last day of the month in that week