Java Month of Year getDefaultHolidays(int year, int month)

Here you can find the source of getDefaultHolidays(int year, int month)

Description

get Default Holidays

License

Apache License

Declaration

static public int getDefaultHolidays(int year, int month) 

Method Source Code

//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;
    }
}

Related

  1. daysInMonth(int year, int month)
  2. get_NextSunday_YearMonthDay_integerArray()
  3. getActualMonthBefore(int year, int month, int i)
  4. getCalforMonth(String month, String year)
  5. getDaysByYearMonth(int year, int month)
  6. getEndOfMonth(String year, String month)
  7. getFirstMonthOfThisYear()
  8. getFirstTimeOfDay(int year, int month, int day)
  9. getLastCompletedMonthAndYear()