代码
protected Date adustOffSetDate(Date useDate, int BEGIN_DATE_OFFSET) {
if(useDate == null){
return null;
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(useDate);
int volatilityNum = BEGIN_DATE_OFFSET >= 0 ? 1 : -1;
for (int i = 0; i < Math.abs(BEGIN_DATE_OFFSET); i++) {
calendar.add(Calendar.DATE, volatilityNum);
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
if (Calendar.SATURDAY == dayOfWeek || Calendar.SUNDAY == dayOfWeek) {
i--;
}
}
return calendar.getTime();
}