I want understand these code before java lab exam especially methode
import javax.swing.;
import java.util.;
import java.text.*;
public class EnglishCalendar
{
public static String[] months = {
"January" , "February" , "March",
"April" , "May" , "June",
"July" , "August" , "September",
"October" , "November" , "December"
};
public static int days[] = {
31, 28, 31,
30, 31, 30,
31, 31, 30,
31, 30, 31
};
private void showMonth(int m, int y) {
int lead_spaces = 0;
if (m < 0 || m > 11) {
System.out.println("It should be 1 to 12");
}
else {
System.out.println();
System.out.println(" " + months[m] + " " + y);
System.out.println();
GregorianCalendar cal = new GregorianCalendar(y, m, 0);
System.out.println("Su Mo Tu We Th Fr Sa ");
lead_spaces = cal.get(Calendar.DAY_OF_WEEK);
int day_of_month = days[m];
if (cal.isLeapYear(cal.get(Calendar.YEAR)) && m == 1){ day_of_month++;}
for (int i = 0; i < lead_spaces; i++) {
System.out.print(" ");
}
for (int i = 1; i <= day_of_month; i++) {
if (i < 10) System.out.print(" ");
System.out.print(i);
if ((lead_spaces + i) % 7 == 0) {
System.out.println();
}
else {
System.out.print(" ");
} }
System.out.println(); } }
private static void doSimpleDateFormat() {
Calendar now = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
System.out.print(" \n It is now : " + formatter.format(now.getTime()));
System.out.println();
}
public static void main(String[] args) {
String mo = JOptionPane.showInputDialog("Month");
String ye = JOptionPane.showInputDialog("Year");
int mon = new Integer(mo).intValue();
int yea = new Integer(ye).intValue();
EnglishCalendar k = new EnglishCalendar();
k.showMonth(mon - 1 , yea);
doSimpleDateFormat();
}
}