Here you can find the source of getPerMonthByCuttentYear()
public static List<String> getPerMonthByCuttentYear()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; public class Main { private static SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); public static List<String> getPerMonthByCuttentYear() { String year = getCurrentYear(); // String year = "2013"; Calendar a = Calendar.getInstance(); int month = a.get(Calendar.MONTH) + 1; List<String> months = new ArrayList<String>(); for (int i = month; i > 0; i--) { // if(i!=8 && i!=9 && i!=10 && i!=11) months.add(year + "-" + String.format("%02d", i)); }// ww w. j a v a 2 s.c o m return months; } public static String getCurrentYear() { return yearFormat.format(new Date()); } }