Here you can find the source of formatDuration(Duration duration)
public static String formatDuration(Duration duration)
//package com.java2s; //License from project: Open Source License import java.time.Duration; public class Main { public static String formatDuration(Duration duration) { return String.format("%02d:%02d:%02d", duration.toHours(), duration.getSeconds() % 3600 / 60, duration.getSeconds() % 60); }/*from w w w. j a va 2s. co m*/ }