Here you can find the source of getWeekOfPreYearWeek(int year, int week)
public static int getWeekOfPreYearWeek(int year, int week)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static int getWeekOfPreYearWeek(int year, int week) { return week == 1 ? getMaxWeekNumOfYear(year) : week - 1; }/*from w ww . j a va 2 s.com*/ public static int getMaxWeekNumOfYear(int year) { Calendar c = new GregorianCalendar(); c.set(year, Calendar.DECEMBER, 31, 23, 59, 59); return getWeekNumber(c.getTime()); } public static int getWeekNumber(Date date) { Calendar c = new GregorianCalendar(); c.setFirstDayOfWeek(Calendar.MONDAY); c.setMinimalDaysInFirstWeek(7); c.setTime(date); return c.get(Calendar.WEEK_OF_YEAR); } }