Here you can find the source of getYears(Integer limit)
public static List<Integer> getYears(Integer limit)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class Main { public static List<Integer> getYears(Integer limit) { List<Integer> years = new ArrayList<Integer>(); Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int count = year + limit; int i = (year); for (; i < count; i++) { years.add(i);//w w w . j a v a2s . co m } return years; } }