Here you can find the source of getNextMonth(String curYearMonth)
public static String getNextMonth(String curYearMonth)
//package com.java2s; public class Main { public static String getNextMonth(String curYearMonth) { int year = Integer.parseInt(curYearMonth.substring(0, 4)); int month = Integer.parseInt(curYearMonth.substring(4)); if (month == 12) { year += 1;//from ww w. j a v a2 s . c om month = 1; } else { month += 1; } StringBuffer strb = new StringBuffer().append(year); if (month > 9) strb.append(month); else strb.append("0").append(month); return strb.toString(); } }