Java Math - toDegrees() Method
The Java toDegrees() method returns an angle measured in radians to an approx. equivalent angle measured in degrees.
Syntax
public static double toDegrees(double angrad)
Parameters
angrad |
Specify an angle in radians. |
Return Value
Returns the angle measured in degrees.
Exception
NA.
Example:
In the example below, toDegrees() method returns an angle measured in radians into angle measured in degrees.
public class MyClass { public static void main(String[] args) { double pi = Math.PI; System.out.println(Math.toDegrees(pi/6)); System.out.println(Math.toDegrees(pi/3)); System.out.println(Math.toDegrees(pi/2)); System.out.println(Math.toDegrees(pi)); } }
The output of the above code will be:
29.999999999999996 59.99999999999999 90.0 180.0
❮ Java Math Methods