private static void adjustToIntervalLowerBound(Calendar now,ScheduleInterval interval,int multiple){
  now.set(Calendar.SECOND,0);
  now.set(Calendar.MILLISECOND,0);
switch (interval) {
case MINUTE:
    now.set(Calendar.MINUTE,alignDown(now.get(Calendar.MINUTE),multiple,0));
  break;
case HOUR:
now.set(Calendar.HOUR_OF_DAY,alignDown(now.get(Calendar.HOUR_OF_DAY),multiple,0));
now.set(Calendar.MINUTE,0);
break;
case DAY:
now.set(Calendar.DAY_OF_MONTH,alignDown(now.get(Calendar.DAY_OF_MONTH),multiple,1));
now.set(Calendar.HOUR_OF_DAY,0);
now.set(Calendar.MINUTE,0);
break;
case WEEK:
now.set(Calendar.WEEK_OF_YEAR,alignDown(now.get(Calendar.WEEK_OF_YEAR),multiple,1));
now.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY);
now.set(Calendar.HOUR_OF_DAY,0);
now.set(Calendar.MINUTE,0);
break;
case MONTH:
now.set(Calendar.MONTH,alignDown(now.get(Calendar.MONTH),multiple,Calendar.JANUARY));
now.set(Calendar.DAY_OF_MONTH,1);
now.set(Calendar.HOUR_OF_DAY,0);
now.set(Calendar.MINUTE,0);
break;
case YEAR:
now.set(Calendar.YEAR,alignDown(now.get(Calendar.YEAR),multiple,1970));
now.set(Calendar.MONTH,Calendar.JANUARY);
now.set(Calendar.DAY_OF_MONTH,1);
now.set(Calendar.HOUR_OF_DAY,0);
now.set(Calendar.MINUTE,0);
break;
default :
throw new IllegalArgumentException(String.format("Invalid interval: %s",interval.toString()));
}
}

private static void adjustToIntervalLowerBound ( Calendar now , ScheduleInterval interval , int multiple ) { now . set ( Calendar . SECOND , 0 ) ; now . set ( Calendar . MILLISECOND , 0 ) ; switch ( interval ) { case MINUTE : now . set ( Calendar . MINUTE , alignDown ( now . get ( Calendar . MINUTE ) , multiple , 0 ) ) ; break ; case HOUR : now . set ( Calendar . HOUR_OF_DAY , alignDown ( now . get ( Calendar . HOUR_OF_DAY ) , multiple , 0 ) ) ; now . set ( Calendar . MINUTE , 0 ) ; break ; case DAY : now . set ( Calendar . DAY_OF_MONTH , alignDown ( now . get ( Calendar . DAY_OF_MONTH ) , multiple , 1 ) ) ; now . set ( Calendar . HOUR_OF_DAY , 0 ) ; now . set ( Calendar . MINUTE , 0 ) ; break ; case WEEK : now . set ( Calendar . WEEK_OF_YEAR , alignDown ( now . get ( Calendar . WEEK_OF_YEAR ) , multiple , 1 ) ) ; now . set ( Calendar . DAY_OF_WEEK , Calendar . SUNDAY ) ; now . set ( Calendar . HOUR_OF_DAY , 0 ) ; now . set ( Calendar . MINUTE , 0 ) ; break ; case MONTH : now . set ( Calendar . MONTH , alignDown ( now . get ( Calendar . MONTH ) , multiple , Calendar . JANUARY ) ) ; now . set ( Calendar . DAY_OF_MONTH , 1 ) ; now . set ( Calendar . HOUR_OF_DAY , 0 ) ; now . set ( Calendar . MINUTE , 0 ) ; break ; case YEAR : now . set ( Calendar . YEAR , alignDown ( now . get ( Calendar . YEAR ) , multiple , 1970 ) ) ; now . set ( Calendar . MONTH , Calendar . JANUARY ) ; now . set ( Calendar . DAY_OF_MONTH , 1 ) ; now . set ( Calendar . HOUR_OF_DAY , 0 ) ; now . set ( Calendar . MINUTE , 0 ) ; break ; default : throw new IllegalArgumentException ( String . format ( "Invalid interval: %s" , interval . toString ( ) ) ) ; } }
adjust the calendar object to the start boundary of specified time interval that it ' s currently in . note : if the multiple parameter exceeded the next level interval , it will be same as specifying next level interval with multiple = 1 .
