private void applyLastDayOfMonth(Calendar cal,int month){
  cal.set(Calendar.MONTH,month + 1);
  cal.set(Calendar.DAY_OF_MONTH,1);
  cal.add(Calendar.DAY_OF_MONTH,-1);
}

private void applyLastDayOfMonth ( Calendar cal , int month ) { cal . set ( Calendar . MONTH , month + 1 ) ; cal . set ( Calendar . DAY_OF_MONTH , 1 ) ; cal . add ( Calendar . DAY_OF_MONTH , - 1 ) ; }
sets the calendar to the last day of the given month .
