Converts miles per hour to kilometers per hour - Java java.lang

Java examples for java.lang:Math Convert

Description

Converts miles per hour to kilometers per hour

Demo Code


//package com.java2s;

public class Main {
    private static final double MPH_TO_KPH_RATIO = 1.609;

    /**// ww  w .  ja v a 2 s  .  c o m
     * Converts miles per hour to kilometers per hour
     *
     * @param mph speed in Miles/Hour
     * @return speed in km/h
     */
    public static double mphToKmph(double mph) {
        return mph * MPH_TO_KPH_RATIO;
    }
}

Related Tutorials