Here you can find the source of getActualMonthBefore(int year, int month, int i)
public static String getActualMonthBefore(int year, int month, int i)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getActualMonthBefore(int year, int month, int i) { SimpleDateFormat daytime = new SimpleDateFormat("yyyyMM"); Calendar calendar = Calendar.getInstance(); calendar.set(year, month, 1);//from w w w. j av a2 s . c om calendar.set(Calendar.MONTH, calendar.get(Calendar.MONDAY) - (i + 1)); return daytime.format(calendar.getTime()); } }