Custom implementation of date class in Java