// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.Calendar;
import java.util.GregorianCalendar;

public class Week {
    public static void main(String[] args) {
        Calendar today = new GregorianCalendar();
        System.out.println(today.get(Calendar.WEEK_OF_YEAR));
        Calendar may17 = new GregorianCalendar(2008, Calendar.MAY, 17);
        System.out.println(may17.get(Calendar.WEEK_OF_YEAR));
        Calendar last = new GregorianCalendar(2008, Calendar.DECEMBER, 31);
        while(last.get(Calendar.WEEK_OF_YEAR) == 1) last.add(Calendar.DAY_OF_MONTH, -1);
        System.out.println(last.get(Calendar.WEEK_OF_YEAR));
    }
}
