Here you can find the source of dayOfYear(final int year, final int month, final int day)
public static int dayOfYear(final int year, final int month, final int day)
//package com.java2s; //License from project: Open Source License public class Main { public static int dayOfYear(final int year, final int month, final int day) { int day_of_year; if (isLeapYear(year)) { day_of_year = 275 * month / 9 - (month + 9) / 12 + day - 30; } else {//from ww w . j av a 2 s . c o m day_of_year = 275 * month / 9 - ((month + 9) / 12 << 1) + day - 30; } return day_of_year; } public static boolean isLeapYear(final int y) { boolean result = false; if (y % 4 == 0 && (y < 1582 || y % 100 != 0 || y % 400 == 0)) { result = true; } return result; } }