Here you can find the source of getNextEndDate(Date date, int offset)
public static Date getNextEndDate(Date date, int offset)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date getNextEndDate(Date date, int offset) { if (offset < 1) { return date; } else {/*w ww . java 2 s . com*/ Calendar calendar = Calendar.getInstance(); calendar.setTime(date); for (int dayOfWeek = calendar.get(7); offset > 0; --offset) { if (dayOfWeek == 6) { calendar.add(5, 3); } else if (dayOfWeek == 7) { calendar.add(5, 2); } else { calendar.add(5, 1); } } return calendar.getTime(); } } }