Here you can find the source of getElapsedTime(long start, long end)
public static String getElapsedTime(long start, long end)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getElapsedTime(long start, long end) { Calendar result = Calendar.getInstance(); long sa = end - start - result.getTimeZone().getRawOffset(); result.setTimeInMillis(sa);/*ww w. ja v a2s. com*/ SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); return sdf.format(result.getTime()); } }