Here you can find the source of convertSecondsToTimeUnits(int seconds)
public static int[] convertSecondsToTimeUnits(int seconds)
//package com.java2s; //License from project: LGPL public class Main { private static final int MINUTE = 60; private static final int HOUR = 60 * MINUTE; private static final int DAY = 24 * HOUR; public static int[] convertSecondsToTimeUnits(int seconds) { int[] timeUnits = new int[4]; int remnant = seconds; if (remnant >= DAY) { timeUnits[0] = remnant / DAY; remnant = remnant % DAY;// w w w.ja v a 2 s . c o m } if (remnant >= HOUR) { timeUnits[1] = remnant / HOUR; remnant = remnant % HOUR; } if (remnant >= MINUTE) { timeUnits[2] = remnant / MINUTE; remnant = remnant % MINUTE; } timeUnits[3] = remnant; return timeUnits; } }