Here you can find the source of getWeekdayInterval(Date date)
public static int getWeekdayInterval(Date date)
//package com.java2s; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; public class Main { public final static String[] Holidays = new String[] { "1-1", "5-5-1", "7-4", "9-1-1", "10-4-1", "11-4-4", "12-25" }; public static int getWeekdayInterval(Date date) { List<String> holidays = Arrays.asList(Holidays); Calendar now = Calendar.getInstance(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//w w w . j a v a2 s . c o m int d = (int) ((now.getTimeInMillis() - calendar.getTimeInMillis()) / (24 * 60 * 60 * 1000)); int n = 0; for (int i = 0; i < d; i++) { calendar.add(Calendar.DATE, 1); int month = calendar.get(Calendar.MONTH) + 1; int day = calendar.get(Calendar.DAY_OF_MONTH); int week = calendar.get(Calendar.WEEK_OF_MONTH); int week_day = calendar.get(Calendar.DAY_OF_WEEK) - 1; if (holidays.contains(month + "-" + day) || holidays.contains(month + "-" + week + "-" + week_day) || week_day == 0 || week_day == 6) { n++; } } d = d - n; return d; } }