class DurationHelper {

    public static String createDurationValue(Date startTime, Date endTime) {
        final Date current = new Date();
        if (startTime == null) {
            startTime = current;
            log.info("startTime was null, set to current date");
        }
        if (endTime == null) {
            endTime = current;
            log.info("endTime was null, set to current date");
        }
        final Long duration = endTime.getTime() - startTime.getTime() < 0 ? 0 : endTime.getTime() - startTime.getTime();

        return format(new Date(duration));
    }

    private  DurationHelper();

}