Hello ! I need help as to what the code below does for each of its statement, when dd/mm/yyyy format is enter, it should give 20 Dec 2010 is a Monday:
public static String dayOfWeek(int dd, int mm, int yyyy) { int[] monthIndices = {1,4,4,0,2,5,0,3,6,1,4,6}; String[] dayOfWeek = {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}; if ((yyyy % 4 == 0) && !(yyyy % 100 == 0) || (yyyy % 400 == 0)){ monthIndices[0] = 0; monthIndices[1] = 3; } int yy = yyyy % 100; int yyDiv4 = yy / 4; int keyNumber = monthIndices[mm-1]; int sum = yy+yyDiv4+keyNumber+dd; int adjValue = 0; if (yyyy / 100 == 18) adjValue = 2; else if (yyyy / 100 == 20) adjValue = 6; else if (yyyy / 100 == 21) adjValue = 4; int remainder = (sum + adjValue) % 7; String day = dayOfWeek[remainder]; return day; } }