Here you can find the source of decomposeMillis(long millis)
public static final int[] decomposeMillis(long millis)
//package com.java2s; /*//from w w w . ja va 2 s .com Copyright 2009 Semantic Discovery, Inc. (www.semanticdiscovery.com) This file is part of the Semantic Discovery Toolkit. The Semantic Discovery Toolkit is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The Semantic Discovery Toolkit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with The Semantic Discovery Toolkit. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Decompose millis into 0:days, 1:hours, 2:minutes, 3:seconds, 4:millis. */ public static final int[] decomposeMillis(long millis) { final int[] result = new int[5]; result[4] = (int) (millis % 1000); long seconds = (millis / 1000); if (seconds == 0) return result; result[3] = (int) (seconds % 60); long minutes = (seconds / 60); if (minutes == 0) return result; result[2] = (int) (minutes % 60); long hours = (minutes / 60); if (hours == 0) return result; result[1] = (int) (hours % 24); long days = (hours / 24); if (days == 0) return result; result[0] = (int) days; return result; } }