Java Kilometer Convert to kmToKnots(int km)

Here you can find the source of kmToKnots(int km)

Description

Convert kilometers into international nautical miles .

License

LGPL

Parameter

Parameter Description
km The value to convert.

Return

in international nautical miles.

Declaration

public static float kmToKnots(int km) 

Method Source Code

//package com.java2s;
/**//from w  w w . j a  va  2 s. c  om
 * Offers various useful methods related to geopositionning.
 * <p>License: This library is under the GNU Lesser General Public License</p>
 *
 * @author Praplan Christophe
 * @author Velen Stephane
 * @version 1.0 <p>Geneva, the 23.03.2006
 */

public class Main {
    private static final double KnotsToKm = 1.852;

    /**
     * Convert kilometers into international nautical miles .
     *
     * @param km The value to convert.
     * @return in international nautical miles.
     */
    public static float kmToKnots(int km) {
        return (float) (km / KnotsToKm);
    }

    /**
     * Convert kilometers into international nautical miles .
     *
     * @param km The value to convert.
     * @return in international nautical miles.
     */
    public static float kmToKnots(float km) {
        return (float) (km / KnotsToKm);
    }

    /**
     * Convert kilometers into international nautical miles .
     *
     * @param km The value to convert.
     * @return in international nautical miles.
     */
    public static long kmToKnots(long km) {
        return (long) (km / KnotsToKm);
    }

    /**
     * Convert kilometers into international nautical miles .
     *
     * @param km The value to convert.
     * @return in international nautical miles.
     */
    public static double kmToKnots(double km) {
        return km / KnotsToKm;
    }
}

Related

  1. kmToMiles(double k)
  2. kmToRtheta(final double x, final double y)