Java Day in Month daysOfMonth(int year)

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

Description

days Of Month

License

Open Source License

Declaration

private static int[] daysOfMonth(int year) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static final int[] DAYS_OF_MONTH_IN_NORMAL_YEAR = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
            30, 31 };// w  w w. j av a  2s . c o m
    private static final int[] DAYS_OF_MONTH_IN_LEAP_YEAR = new int[] { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30,
            31 };

    private static int[] daysOfMonth(int year) {
        if (isLeapYear(year)) {
            return DAYS_OF_MONTH_IN_LEAP_YEAR;
        }
        return DAYS_OF_MONTH_IN_NORMAL_YEAR;
    }

    private static boolean isLeapYear(int year) {
        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            return true;
        }
        return false;
    }
}

Related

  1. currentMonthFirstDay()
  2. dayForMonth(String pTime)
  3. daysInMonth(int month, boolean isLeapYear)
  4. daysInMonth(int month, int year)
  5. daysInMonth(int year, int month)
  6. daysOfMonth(int year, int month)
  7. firstDayOfLastMonth()
  8. firstDayOfMonth(int commonMonthIndx, int iyear)
  9. firstDayOfMonth(int year, int month, String dateFormat)