View Javadoc
1   
2   public class DateController {
3   
4   	public DateController() {
5   		super();
6   	}
7   
8   	public boolean isLeapYear(Date t) {
9   		// if para comprobar que los valores no sean negativos o 0
10  		if (t.getDay() <= 0 || t.getMonth() <= 0 || t.getYear() < 0) {
11  			throw new NumerosValidosException("Numeros negativos o 0 no validos");
12  		}
13  		if (t.getYear() % 4 == 0) {
14  			if (t.getYear() % 100 == 0) {
15  				if (t.getYear() % 400 == 0) {
16  					return true;
17  				} else {
18  					return false;
19  				}
20  			} else {
21  				return true;
22  			}
23  		} else {
24  			return false;
25  		}
26  	}
27  
28  }