Building a custom time class in Java