Here you can find the source of speedToPace(float speedInMetersPerSecond, boolean imperial)
public static String speedToPace(float speedInMetersPerSecond, boolean imperial)
//package com.java2s; //License from project: Open Source License public class Main { private static final float ratio = 1.609344f; public static String speedToPace(float speedInMetersPerSecond, boolean imperial) { if (speedInMetersPerSecond <= 0) { return "0:00"; }/* w w w.j a va2s .c o m*/ float speedPerHour = speedInMetersPerSecond / 1000 * 60 * 60; if (imperial) { speedPerHour = speedPerHour / ratio; } float pacePerMinute = 60 / speedPerHour; long minutes = (long) Math.floor(pacePerMinute); long seconds = Math.round((pacePerMinute - minutes) * 60); return String.format("%02d:%02d", minutes, seconds); } }