Here you can find the source of calculateEndDate(Date startDate, int duration)
public static Date calculateEndDate(Date startDate, int duration)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date calculateEndDate(Date startDate, int duration) { Calendar startCal = Calendar.getInstance(); startCal.setTime(startDate);//from w ww . j a va2 s .co m for (int i = 1; i < duration; i++) { startCal.add(Calendar.DAY_OF_MONTH, 1); while (startCal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || startCal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { startCal.add(Calendar.DAY_OF_MONTH, 1); } } return startCal.getTime(); } }