Converts degrees to radians. - Java java.lang

Java examples for java.lang:Math Geometry

Description

Converts degrees to radians.

Demo Code


//package com.java2s;

public class Main {
    /**/*from  ww  w  .  jav a2  s .c o  m*/
     * Converts degrees to radians.
     * 
     * <p>
     * This method uses double precision internally, though it returns single float. Factor = pi /
     * 180.
     * 
     * @param degrees
     *        The angle in degrees.
     * @return The angle in radians.
     */
    public static float toRadians(float degrees) {
        return (float) (degrees * 0.017453292519943295769236907684886);
    }
}

Related Tutorials