// 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.Date;
import java.util.GregorianCalendar;

public class Friday {
    public static Date next(int n, int weekday) {
        Calendar ref = new GregorianCalendar();
        while(ref.get(Calendar.DAY_OF_WEEK) != weekday) {
            ref.add(Calendar.DAY_OF_YEAR, 1);
        }
        ref.add(Calendar.WEEK_OF_YEAR, n);
        return ref.getTime();
    }
    public static void main(String[] args) {
        for (int i = -10; i <= 10; i++) {
            System.out.println(i + " : " + next(i, Calendar.FRIDAY));
        }
    }
}
