Here you can find the source of getDayOfWeek(long time)
public static int getDayOfWeek(long time)
//package com.java2s; import java.util.Calendar; public class Main { public static Calendar calendar = Calendar.getInstance(); public static int getDayOfWeek(long time) { calendar.clear();/*from ww w.jav a 2 s . c om*/ calendar.setTimeInMillis(time); int result = calendar.get(Calendar.DAY_OF_WEEK) - 1; if (result <= 0) { result = 7; } return result; } }