// works in C, C++, C#, Java, JavaScript, and other C-like languages
// optimal technique
if (((year & 3) == 0 && ((year % 25) != 0) || (year & 15) == 0)) {
// leap year
}
// classic technique
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
// leap year
}