Here you can find the source of formatSecondFractions(long numUnits, int denominator)
Parameter | Description |
---|---|
numUnits | a parameter |
public static String formatSecondFractions(long numUnits, int denominator)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w .jav a 2s. com*/ * * @param numUnits * @return */ public static String formatSecondFractions(long numUnits, int denominator) { if (numUnits == 0) { return "0:00:00"; } StringBuffer timeStr = new StringBuffer(10); // long deciSeconds = (numMicroseconds / denominator ) % 10; long seconds = (numUnits / denominator) % 60; long minutes = (numUnits / denominator / 60) % 60; long hours = (numUnits / denominator / 60 / 60); timeStr.append(hours); timeStr.append(":"); if (minutes < 10) { timeStr.append("0").append(minutes); } else { timeStr.append(minutes); } timeStr.append(":"); if (seconds < 10) { timeStr.append("0").append(seconds); } else { timeStr.append(seconds); } // timeStr.append("."); // timeStr.append(deciSeconds); return timeStr.toString(); } }