Util.java 595 Bytes
package com.cnlive.demo.video;

import java.util.Locale;

/**
 * Created by xiansong on 2016/7/4.
 */
public class Util {

    public static String stringForTime(long second) {
        int totalSeconds = (int) second;

        int seconds = totalSeconds % 60;
        int minutes = (totalSeconds / 60) % 60;
        int hours = totalSeconds / 3600;

        if (hours > 0) {
            return String.format(Locale.getDefault(), "%d:%02d:%02d", hours, minutes, seconds);
        } else {
            return String.format(Locale.getDefault(), "%02d:%02d", minutes, seconds);
        }
    }



}