Android Unit Convert convertToPerHour(float speedInMetersPerSecond, boolean imperial)

Here you can find the source of convertToPerHour(float speedInMetersPerSecond, boolean imperial)

Description

convert To Per Hour

License

Open Source License

Declaration

public static String convertToPerHour(float speedInMetersPerSecond,
            boolean imperial) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static final float ratio = 1.609344f;

    public static String convertToPerHour(float speedInMetersPerSecond,
            boolean imperial) {
        float speedPerHour = speedInMetersPerSecond / 1000 * 60 * 60;
        if (imperial) {
            speedPerHour = speedPerHour / ratio;
        }//w ww  .j  a  v a2s.c  om
        return String.format("%02.02f", speedPerHour);
    }
}

Related

  1. convertUnits(double value, String oldUnits, String newUnits)
  2. formatHeartRate(int bpm)
  3. formatHeartRate(int bpm, boolean withUnit)
  4. convertLength(float length, int fromScale, int toScale)
  5. convertBarometricPressure(float pressure, int fromScale, int toScale)
  6. convertFromHgInchToHpa(float hgInch)
  7. convertFromHpaToHgInch(float hpa)
  8. convertFromInchToMillimetre(float length)