Here you can find the source of formatTime(BigDecimal seconds)
public static String formatTime(BigDecimal seconds)
//package com.java2s; //License from project: LGPL import java.math.BigDecimal; public class Main { private static final String TIME_FORMAT = "%02d:%02d:%02d.%03d"; public static String formatTime(BigDecimal seconds) { int whole = seconds.intValue(); BigDecimal frac = seconds.subtract(new BigDecimal(whole)); int f = frac.multiply(new BigDecimal(1000)).intValue(); int m = whole / 60; int s = whole % 60; int h = m / 60; m = m % 60;/*w ww.j av a2s . co m*/ return String.format(TIME_FORMAT, h, m, s, f); } }