Maneesh suggested earlier the method
System.currentTimeMillis(), so you could do some calculation and define how much time passed since the last time method ran.
i.e.
Probably there are more ways to do that, might even better ones. That way is very procedural.
You should think towards the way encapsulating that knowledge to object so it would know if it needs to be executed or not.
Maneesh gave some idea along that, I just think that method name of example is a bit misleading, because
amHungryButOnDiet() would do eating if not eaten within 4 hours, but the method name does suggest something different. Well, it isn't an easy task to come up with a good variables or methods names - takes time.