Android Utililty Methods Speed Readable Format

List of utility methods to do Speed Readable Format

Description

The list of methods to do Speed Readable Format are organized into topic(s).

Method

StringspeedToKMH(double kmh)
speed To KMH
return round(kmh) + " km/h";
StringspeedToMPH(double kmh)
speed To MPH
return round(kmh * 0.621) + " mph";
StringspeedToPace(float speedInMetersPerSecond, boolean imperial)
speed To Pace
if (speedInMetersPerSecond <= 0) {
    return "0:00";
float speedPerHour = speedInMetersPerSecond / 1000 * 60 * 60;
if (imperial) {
    speedPerHour = speedPerHour / ratio;
float pacePerMinute = 60 / speedPerHour;
...
floatconvertSpeed(float speed, int fromScale, int toScale)
convert a speed measurement from one scale to another
switch (fromScale) {
case KPH:
    switch (toScale) {
    case MPH:
        return convertFromKphToMph(speed);
    default:
        throw new IllegalArgumentException("invalid toScale");
case MPH:
    switch (toScale) {
    case KPH:
        return convertFromMphToKph(speed);
    default:
        throw new IllegalArgumentException("invalid toScale");
default:
    throw new IllegalArgumentException("invalid fromScale");