Here you can find the source of getDefaultHolidays(int year, int month)
static public int getDefaultHolidays(int year, int month)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.GregorianCalendar; public class Main { static public int getDefaultHolidays(int year, int month) { GregorianCalendar cal = new GregorianCalendar(year, month - 1, 1); int x = 0; for (int d = 0;; d++) { int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); if (dayOfWeek == Calendar.SUNDAY || dayOfWeek == Calendar.SATURDAY) x |= (1 << d);// w ww . jav a2s . co m cal.add(Calendar.DAY_OF_YEAR, 1); if (cal.get(Calendar.MONTH) + 1 != month) break; } return x; } }