The toDegrees() method of Java Math class converts a radian angle to an approximately equivalent angle measured in degrees.
Syntax:
public static double toDegrees(double angrad)
Parameters:
The parameter ‘angrad ‘represents an angle measured in radians.
Return Value:
The toDegrees () method returns the angrad’s measurement in degrees.
Example 1:
1 2 3 4 5 6 7 8 9 |
public class JavaMathToDegreesExample1 { public static void main(String[] args) { double a=10.780; //converts a radian angle to an approximately equivalent angle measured in degrees System.out.println("Radian Angle "+ a+" converted in degrees = "+Math.toDegrees(a)); } } |
Output:
1 2 3 |
Radian Angle 10.78 converted in degrees = 617.6485031510274 |
Example 2:
1 2 3 4 5 6 7 8 9 |
public class JavaMathToDegreesExample2 { public static void main(String[] args) { double a=Double.MIN_VALUE; //converts a radian angle to an approximately equivalent angle measured in degrees System.out.println("Radian Angle "+ a+" converted in degrees = "+Math.toDegrees(a)); } } |
Output:
1 2 3 |
Radian Angle 4.9E-324 converted in degrees = 2.8E-322 |
Example 3:
1 2 3 4 5 6 7 8 9 |
public class JavaMathToDegreesExample3 { public static void main(String[] args) { double a=Double.NaN; //converts a radian angle to an approximately equivalent angle measured in degrees System.out.println("Radian Angle "+ a+" converted in degrees = "+Math.toDegrees(a)); } } |
Output:
1 2 3 |
Radian Angle NaN converted in degrees = NaN |
Example 4:
1 2 3 4 5 6 7 8 9 |
public class JavaMathToDegreesExample4 { public static void main(String[] args) { double a=Double.NEGATIVE_INFINITY; //converts a radian angle to an approximately equivalent angle measured in degrees System.out.println("Radian Angle "+ a+" converted in degrees = "+Math.toDegrees(a)); } } |
Output:
1 2 3 |
Radian Angle -Infinity converted in degrees = -Infinity |
Example 5:
1 2 3 4 5 6 7 8 9 |
public class JavaMathToDegreesExample5 { public static void main(String[] args) { double a=-0d; //converts a radian angle to an approximately equivalent angle measured in degrees System.out.println("Radian Angle "+ a+" converted in degrees = "+Math.toDegrees(a)); } } |
Output:
1 2 3 |
Radian Angle -0.0 converted in degrees = -0.0 |