Skip to content
Related Articles

Related Articles

Improve Article

Java toDegrees() method with Example

  • Last Updated : 12 Apr, 2018
Geek Week

The java.lang.Math.toDegrees() is used to convert an angle measured in radians to an approximately equivalent angle measured in degrees.

Note: The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0.


public static double toDegrees(double rad)

rad : This parameter is an angle in radians which
we want to convert in degrees.
Return :
This method returns the measurement of the angle 
rad in degrees.

Example: To show working of java.lang.Math.toDegrees() method.

// Java program to demonstrate working
// of java.lang.Math.toDegrees() method
import java.lang.Math;
class Gfg {
    // driver code
    public static void main(String args[])
        // value of PI in degrees
        double rad = Math.PI;
        // value of PI/2 in degrees
        rad = (Math.PI) / 2;
        // value of PI/4 in degrees
        rad = (Math.PI) / 4;



Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :