static final long MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000L; static final long MILLISECONDS_PER_HOUR = 60 * 60 * 1000L; static final long MILLISECONDS_PER_MINUTE = 60 * 1000L; static final long MILLISECONDS_PER_SECOND = 1000L; long millis = days * MILLISECONDS_PER_DAY + hours * MILLISECONDS_PER_HOUR + minutes * MILLISECONDS_PER_MINUTE + seconds * MILLISECONDS_PER_SECOND + milliseconds;