Write code to get Formatted Time from second in double
//package com.book2s; import java.util.Formatter; public class Main { public static void main(String[] argv) { double timeInSeconds = 42.45678; System.out.println(getFormattedTime(timeInSeconds)); }/* ww w .j av a2s . c om*/ public static String getFormattedTime(double timeInSeconds) { int intTime = (int) timeInSeconds; final int hours = intTime / 3600; intTime = intTime % 3600; final int min = intTime / 60; intTime = intTime % 60; final StringBuilder stringBuilder = new StringBuilder(); final Formatter formatter = new Formatter(stringBuilder); formatter.format("%02d:%02d:%02d", hours, min, intTime); formatter.close(); return stringBuilder.toString(); } }