Here you can find the source of getWeekOfYearYear(GregorianCalendar cal)
public static int getWeekOfYearYear(GregorianCalendar cal)
//package com.java2s; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static int getWeekOfYearYear(GregorianCalendar cal) { int y = cal.get(Calendar.YEAR); int m = cal.get(Calendar.MONTH) + 1 - Calendar.JANUARY; int w = cal.get(Calendar.WEEK_OF_YEAR); if (w == 1 && m == 12) return y + 1; if (w > 50 && m == 1) return y - 1; return y; }/*from w w w. ja v a 2 s . c om*/ }