Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static int MIN_YEAR = 1970; public static int getDayWeek(int index) { int year = MIN_YEAR + index / 12; int month = index % 12; SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Calendar date = new GregorianCalendar(year, month, 1); int dayweek = date.get(Calendar.DAY_OF_WEEK); return dayweek; } }