Java Day in Month getMonthDaysArray(int year)

Here you can find the source of getMonthDaysArray(int year)

Description

get Month Days Array

License

Open Source License

Declaration

public static int[] getMonthDaysArray(int year) 

Method Source Code

//package com.java2s;

public class Main {

    public static int[] getMonthDaysArray(int year) {
        int[] a1 = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        int[] a2 = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

        if (year <= 1582) {
            if ((year % 4) == 0) {
                if (year == 4) {
                    return a1;
                }//from ww w . j a  va 2s.  co m
                return a2;
            }
        } else {
            if (((year % 4) == 0) && ((year % 100) != 0)) {
                return a2;
            } else if ((year % 400) == 0) {
                return a2;
            }
        }

        return a1;
    }
}

Related

  1. getMaxDayByMonth(String month)
  2. getMaxMonthDay(int year, int month)
  3. getMonthDay(int year, int month)
  4. getMonthDayFormats()
  5. getMonthDays(int year, int month)
  6. getMonthDayString(long l, boolean timezone, boolean formated)
  7. getMonthlyCronExpression(int minutes, int hours, int dayOfMonth)
  8. getMonthOfDayMark(int day)
  9. getNumberOfDaysInMonth(Integer year, Integer month)