Here you can find the source of toNextWorkDay(Calendar cal)
public static void toNextWorkDay(Calendar cal)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static final String DATE = "yyyy-MM-dd"; public static void toNextWorkDay(Calendar cal) { if (isRestDay(cal)) { cal.add(Calendar.DATE, 1); toNextWorkDay(cal);/* w ww . ja v a 2 s. c o m*/ } } public static final boolean isRestDay(Calendar cal) { int weekDay = cal.get(Calendar.DAY_OF_WEEK); return weekDay == Calendar.SATURDAY || weekDay == Calendar.SUNDAY; } public static final boolean isRestDay(Date d) { Calendar cal = Calendar.getInstance(); cal.setTime(d); int weekDay = cal.get(Calendar.DAY_OF_WEEK); return weekDay == Calendar.SATURDAY || weekDay == Calendar.SUNDAY; } }