Here you can find the source of isDayOfWeek(String str, int dayOfWeek)
public static boolean isDayOfWeek(String str, int dayOfWeek)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static boolean isDayOfWeek(String str, int dayOfWeek) { int day = getCalendar(str).get(Calendar.DAY_OF_WEEK); if (day == dayOfWeek) return true; else/*from w w w. ja v a 2 s .c o m*/ return false; } public static boolean isDayOfWeek(Date date, int dayOfWeek) { int day = getCalendar(date).get(Calendar.DAY_OF_WEEK); if (day == dayOfWeek) return true; else return false; } public static Calendar getCalendar(String str) { int yy = Integer.parseInt(str.substring(0, 4)); int mm = Integer.parseInt(str.substring(4, 6)) - 1; int dd = Integer.parseInt(str.substring(6, 8)); Calendar cal = Calendar.getInstance(); cal.set(yy, mm, dd); return cal; } public static Calendar getCalendar(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal; } }