Here you can find the source of getDays(String yyyy)
public static String[] getDays(String yyyy) throws Exception
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String[] getDays(String yyyy) throws Exception { StringBuilder sb = new StringBuilder(); long starttime = stringToTime("yyyyMMdd", yyyy + "0101").getTime(); long lasttime = stringToTime("yyyyMMdd", yyyy + "1231").getTime(); for (; starttime <= lasttime; starttime += 1000 * 3600 * 24) { sb.append(timeToString("yyyyMMdd", new Date(starttime))); sb.append(':'); }/*from w ww .j a va 2 s .co m*/ return sb.toString().split(":"); } public static Date stringToTime(String format, String sDate) throws Exception { DateFormat df = new SimpleDateFormat(format); Date _date = df.parse(sDate); if (timeToString(format, _date).equals(sDate)) { return _date; } else { throw new Exception(sDate + " is error"); } } public static String timeToString(String format, Date date) { DateFormat df = new SimpleDateFormat(format); return df.format(date); } }