标签:print string bsp str int 转换 nsf ati code
将一个秒数转换为时分秒形式,例如91秒=00:01:31
public class Main { public static void main(String[] args) { System.out.println(transfom(3665)); } public static String transfom(final int time) { int hh = time / 3600; int mm = (time % 3600) / 60; int ss = (time % 3600) % 60; return (hh < 10 ? ("0" + hh) : hh) + ":" + (mm < 10 ? ("0" + mm) : mm) + ":" + (ss < 10 ? ("0" + ss) : ss); } }
供小伙伴们参考!
标签:print string bsp str int 转换 nsf ati code
原文地址:https://www.cnblogs.com/yangfan326/p/9708334.html