public static String durationToFormattedString(final Duration duration) {
        if (duration == null) {
            return null;
        }

        return LocalTime.ofNanoOfDay(duration.toNanos()).format(DateTimeFormatter.ofPattern(DURATION_FORMAT));
    }
public static String durationToFormattedString ( final Duration duration ) { if ( duration == null ) { return null ; } return LocalTime . ofNanoOfDay ( duration . toNanos ( ) ) . format ( DateTimeFormatter . ofPattern ( DURATION_FORMAT ) ) ; }
Converts a Duration into a formatted String

@param duration
duration, which will be converted into a formatted String
@return String in the duration format, specified at
{@link #DURATION_FORMAT}