Here you can find the source of getyears(List
public static List<Integer> getyears(List<Long> numberList)
//package com.java2s; //License from project: Artistic License import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.GregorianCalendar; import java.util.List; public class Main { /************************************************************************************************************************************/ public static List<Integer> getyears(List<Long> numberList) { List<Integer> returnList = new ArrayList<Integer>(); Calendar cal = new GregorianCalendar(); int year = cal.get(Calendar.YEAR); int size = numberList.size(); for (int i = 0; i < size; i++) { Long number = (Long) numberList.get(i); if ((number > 1980) && (number <= year)) { returnList.add(Integer.parseInt(numberList.get(i).toString())); }/* ww w . ja v a2 s . co m*/ } Collections.sort(returnList); return returnList; } }