public static String durationString(long periodMs) {
        StringBuilder bld = new StringBuilder();
        Duration duration = Duration.ofMillis(periodMs);
        long hours = duration.toHours();
        if (hours > 0) {
            bld.append(hours).append("h");
            duration = duration.minusHours(hours);
        }
        long minutes = duration.toMinutes();
        if (minutes > 0) {
            bld.append(minutes).append("m");
            duration = duration.minusMinutes(minutes);
        }
        long seconds = duration.getSeconds();
        if ((seconds != 0) || bld.toString().isEmpty()) {
            bld.append(seconds).append("s");
        }
        return bld.toString();
    }
@Test
    public void testDurationString() {
        assertEquals("1m", durationString(60000));
        assertEquals("1m1s", durationString(61000));
        assertEquals("1m1s", durationString(61200));
        assertEquals("5s", durationString(5000));
        assertEquals("2h", durationString(7200000));
        assertEquals("2h1s", durationString(7201000));
        assertEquals("2h5m3s", durationString(7503000));
    }