Here you can find the source of getDateByNum(int day)
public static Date getDateByNum(int day)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static Date getDateByNum(int day) { GregorianCalendar gd = new GregorianCalendar(1900, 1, 1); Date date = gd.getTime(); date = nextDay(date, day);/*from w w w . j a v a 2 s.c o m*/ return date; } public static Date nextDay(Date date, int day) { Calendar cal = Calendar.getInstance(); if (date != null) { cal.setTime(date); } cal.add(Calendar.DAY_OF_YEAR, day); return cal.getTime(); } }