Facebook Page Twitter Page LinkedIn Page
× Java Tutorial Java Advanced Java Resources


The Java Math toDegrees() method is used to return 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 below example, toDegrees() method is used to return 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