Here you can find the source of LeapYear(String syear, String smonth, String sday)
public static String LeapYear(String syear, String smonth, String sday)
//package com.java2s; //License from project: Open Source License public class Main { public static String LeapYear(String syear, String smonth, String sday) { long year = Long.parseLong(syear); long month = Long.parseLong(smonth); long day = Long.parseLong(sday); if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) { if (day == 31) day = 30;// ww w. j a v a2 s . co m } else if (month == 2) { if ((day == 31) || (day == 30) || (day == 29)) { if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { day = 29; } else { day = 28; } } } if (day < 10) { return "0" + String.valueOf(day); } else { return String.valueOf(day); } } public static long LeapYear(long year, long month, long day) { if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) { if (day == 31) day = 30; } else if (month == 2) { if ((day == 31) || (day == 30) || (day == 29)) { if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { day = 29; } else { day = 28; } } } return day; } }