Java toRadians() Method
The toRadians() method is used to convert an angle from degrees to radians.
Syntax
double toRadians(double d)
Parameters
d -- Any primitive data type.
Return Value
This method returns a double value.
Example
public class Test{
public static void main(String args[]){
double x = 45.0;
double y = 30.0;
System.out.println( Math.toRadians(x) );
System.out.println( Math.toRadians(y) );
}
}
Compile the above program, and the output result is:
0.7853981633974483 0.5235987755982988
Other Extensions
Java Number Class