Here you can find the source of toMilliseconds(long seconds, long nanos)
public static long toMilliseconds(long seconds, long nanos)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009 Clark N. Hobbie/*from w w w.jav a 2s . c o m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Clark N. Hobbie - initial API and implementation *******************************************************************************/ public class Main { public static long toMilliseconds(long seconds, long nanos) { long result = seconds * 1000; result += nanos / 1000000; long temp = nanos % 1000000; if (temp > 0) result++; return result; } }