Here you can find the source of toTimeString(long frame)
public static String toTimeString(long frame)
//package com.java2s; /*/*w w w.j a v a 2 s. c o m*/ * Copyright (C) 2011 aki@akjava.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { public static String toTimeString(long frame) { long hour = (long) (frame / (60 * 60 * 1000)); long remain = (long) (frame % (60 * 60 * 1000)); long minute = remain / (60 * 1000); remain = remain % (60 * 1000); long second = remain / 1000; remain = remain % 1000; String result = ""; if (hour < 10) { result = "0" + hour; } else { result += hour; } result += ":"; if (minute < 10) { result += "0" + minute; } else { result += minute; } result += ":"; if (second < 10) { result += "0" + second; } else { result += second; } long milli = remain * 60 / 1000; if (milli < 10) { result += ":" + "0" + milli; } else { result += ":" + milli; } return result; } }