该空间是个人实践过程中的总结,欢迎交流吐槽!
【脚本写作】Java:将秒转换为时分秒
上一篇 /
下一篇 2018-03-28 11:11:07
/ 个人分类:Java
package com.jcloud;
public class Study {
public static void main(String[] args) {
long time = 1800l;
Object[] timeObject = totalValueforTime(time);
System.out.println(timeObject[0] + "小时" + timeObject[1] + "分" + timeObject[2] + "秒");
}
public static Object[] totalValueforTime(long value) {
int hour = (int) value / 3600;
int min = (int) (value % 3600 ) / 60;
int second = (int) (value % 3600 ) % 60;
Object[] bjects = new Object[]{hour, min, second};
return objects;
}
}
==========================================
补充:对于上述Object[]输出
for (Object temp : objects) {
System.out.print(temp);
logger.printLog(temp.toString());
}
收藏
举报
TAG: