Here you can find the source of getDaysforYear()
public static long getDaysforYear()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long getDaysforYear() { Date d = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); int year = Integer.valueOf(sdf.format(d).substring(0, 4)); long count = (year % 400 == 0) || (year % 100 != 0) && (year % 4 == 0) ? 366 : 365; return count; }/*from ww w.jav a2s . com*/ }