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