Here you can find the source of getDayOfWeek(Date date)
public static int getDayOfWeek(Date date) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.util.Calendar; import java.util.Date; public class Main { public static int getDayOfWeek(Date date) throws ParseException { Calendar cal = Calendar.getInstance(); cal.setTime(date);/* w ww . j ava 2s . c o m*/ int w = cal.get(Calendar.DAY_OF_WEEK) - 1; if (w < 0) { w = 1; } if (w == 0) { w = 7; } return w; // return get_week(date); } }