public TimePeriod(Date startTime,long duration){
  Validate.notNull(startTime);
  Validate.isTrue(duration > 0);
  this.startTime=startTime;
  this.endTime=new Date(startTime.getTime() + duration);
}

public TimePeriod ( Date startTime , long duration ) { Validate . notNull ( startTime ) ; Validate . isTrue ( duration > 0 ) ; this . startTime = startTime ; this . endTime = new Date ( startTime . getTime ( ) + duration ) ; }
creates time interval [ starttime , starttime + duration ) .
