Here you can find the source of getNumberOfSecondsBetween(final double d1, final double d2)
public static int getNumberOfSecondsBetween(final double d1, final double d2)
//package com.java2s; public class Main { /**//from w w w. ja v a2 s.c o m * milliseconds in a second. */ public static final long SECOND = 1000; public static int getNumberOfSecondsBetween(final double d1, final double d2) { if ((d1 == 0) || (d2 == 0)) { return -1; } return (int) (Math.abs(d1 - d2) / SECOND); } }