Here you can find the source of getDayWithWeek(Date date)
public static int getDayWithWeek(Date date)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static int getDayWithWeek(Date date) { int day = getNumberFromDate(date, Calendar.DAY_OF_WEEK); if (day == 1) { return 7; }/*from w w w. j a va 2s. c o m*/ return day - 1; } public static int getNumberFromDate(Date date, int field) { Calendar cal = Calendar.getInstance(); if (date != null) { cal.setTime(date); } return cal.get(field); } }