Here you can find the source of getMonthFromYM(String ym)
public static String getMonthFromYM(String ym)
//package com.java2s; public class Main { public static final String DEFAULT_DATE_YM_FORMAT = "yyyyMM"; public static String getMonthFromYM(String ym) { if (ym == null || ym.length() != DEFAULT_DATE_YM_FORMAT.length()) { return null; }//from w ww . jav a 2 s. c om return ym.substring(4, 6); } }