Here you can find the source of getNextMonthSpe(String curYearMonth)
public static String getNextMonthSpe(String curYearMonth)
//package com.java2s; public class Main { public static String getNextMonthSpe(String curYearMonth) { curYearMonth = curYearMonth.replace("-", ""); String yearMonth = getNextMonth(curYearMonth); return yearMonth.substring(0, 4) + "-" + yearMonth.substring(4); }/*from ww w. j ava2 s . c o m*/ 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; 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(); } }