Here you can find the source of durationTranslator(String sonarDuration)
public static String durationTranslator(String sonarDuration)
//package com.java2s; //License from project: Open Source License public class Main { public static String durationTranslator(String sonarDuration) { String daysPart = "P" + (sonarDuration.contains("d") ? sonarDuration.substring(0, sonarDuration.indexOf('d')) + "D" : ""); String timePart = (sonarDuration.contains("d") ? sonarDuration.substring(sonarDuration.indexOf('d') + 1) : sonarDuration);/* www . j av a 2 s . c o m*/ return daysPart + (timePart.isEmpty() ? "" : "T" + timePart.replaceAll("min", "M").replaceAll("h", "H")); } }