Here you can find the source of getThisMonthAndCycle()
public static int[] getThisMonthAndCycle()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static int[] getThisMonthAndCycle() { int cycle = 1; String str = new SimpleDateFormat("yyyyMMdd").format(new Date()); int month = Integer.valueOf(str.substring(0, 6)); int day = Integer.valueOf(str.substring(6, 8)); if (day <= 10) { cycle = 1;//from w w w . ja v a2 s. com } if (day > 10 && day <= 20) { cycle = 2; } if (day > 20) { cycle = 3; } return new int[] { month, cycle }; } }