All the rest have 31 except February which has 28 unless it is a leap year, in which case it has 29.

Leap years are those where year % 4 == 0 unless year % 100 == 0 but it's still a leap year when year % 400 == 0.

Or in more simple terms (from Wikipedia):

if (year is not exactly divisible by 4) then (it is a common year)
else
if (year is not exactly divisible by 100) then (it is a leap year)
else
if (year is not exactly divisible by 400) then (it is a common year)
else (it is a leap year)

Of course, this only applies to Gregorian calendars, which we use today... :-)

And BTW, years != month/12, unless you are talking about the total number of months beyond or == 12, so you should say:

(months~=total_days/30;), (years=total_months/12;), (day_of_the_month~=total_days%30). Remember the approximate symbol (~). Approximations are good, if you remember to note them, otherwise you are just plain wrong!

Per David W's post, modular arithmetic returns the remainer of a division operation, so 4%2 is the remainder of 4/2 which is 0. If there are 30 days in a month, then if it is the 15th of the month, the remainder of 15/30 is 15, so 15%30 == 15. If we are using the day of the year to determine the month, and day of the month, assuming all months have 30 days, then if the day is 250, the month is 250/30 == 8 with a remainder of 10. So 250%30 == 10. IE, the date would be the 10th of the 9th month (September 8th) as the 8th month (August) is complete.

I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:

try
{
Runtime run = Runtime.getRuntime();
Process pr = ...

Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...

Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"