Here you can find the source of getTimeFromSeconds(int seconds)
public static String getTimeFromSeconds(int seconds)
//package com.java2s; //License from project: Open Source License public class Main { public static String getTimeFromSeconds(int seconds) { if (seconds > 60) { int minutes = seconds / 60; seconds = seconds % 60;/* w w w . j a v a2 s . c o m*/ if (minutes > 60) { int hours = minutes / 60; minutes = minutes % 60; if (hours > 24) { int days = hours / 24; hours = hours % 24; return days + " days, " + hours + " hours, " + minutes + " minutes, " + seconds + " seconds"; } else { return hours + " hours, " + minutes + " minutes, " + seconds + " seconds"; } } else { return minutes + " minutes, " + seconds + " seconds"; } } else { return seconds + " seconds"; } } }