Here you can find the source of formatCooldown(long time)
public static String formatCooldown(long time)
//package com.java2s; /*/*from w w w.j a va 2s . co m*/ * ItemHelper.java * Source: Equivalent Exchange 3 by Pahimar * License: GPLv3 * */ public class Main { public static String formatCooldown(long time) { long hours = time / 3600; long minutes = (time % 3600) / 60; long seconds = time % 60; String currentCooldown = ""; if (hours > 0) { currentCooldown = String.format("%dh %dm %ds", hours, minutes, seconds); } else if (minutes > 0) { currentCooldown = String.format("%dm %ds", minutes, seconds); } else { currentCooldown = String.format("%ds", seconds); } return currentCooldown; } }