Here you can find the source of millisToTime(float millis)
public static String millisToTime(float millis)
//package com.java2s; //License from project: Open Source License public class Main { public static String millisToTime(float millis) { float secs = millis / 1000; int mins = (int) (secs / 60); secs -= mins * 60;//from w ww. jav a 2s . c om secs = roundToAccuracy(secs, 0.1F); String time = mins + ":" + secs; if (time.length() > time.lastIndexOf('.') + 2) { // has excess zeros time = time.substring(0, time.lastIndexOf('.') + 2); } return time; } private static float roundToAccuracy(float n, float i) { int cutoffN = (int) (n / i); return cutoffN * i; } }