Here you can find the source of getDaysInMonth(int monthNum)
public static int getDaysInMonth(int monthNum)
//package com.java2s; //License from project: Apache License public class Main { final static int DOM[] = { 31, 28, 31, 30, /* jan feb mar apr */ 31, 30, 31, 31, /* may jun jul aug */ 30, 31, 30, 31 /* sep oct nov dec */ };//from w ww .java2 s .c o m public static int getDaysInMonth(int monthNum) { if (monthNum < 0) { throw new IllegalArgumentException("Month number must be non-negative"); } if (monthNum >= 12) { throw new IndexOutOfBoundsException("There are 12 months in a year, so monthNum must be in 0..11"); } return DOM[monthNum]; } }