Java Math toDegrees() Method Last Updated : 12 May, 2025 Comments Improve Suggest changes Like Article Like Report The toDegrees() method comes under the java.lang.Math package. This method is used to convert an angle from radians to its equivalent degrees. This method is useful in mathematical computations where angle conversion is required, for example, trigonometry, geometry etc.Note: The conversion from radians to degrees is not always exact due to floating point precision. The users should not expect cos(toRadians(90.0)) to exactly equal 0.0.Syntax of toDegrees() Methodpublic static double Math.toDegrees(double rad)Parameter: rad: This parameter is an angle in radians which we want to convert in degrees.Returns: It returns the corresponding angle in degrees as a double.Important Points:This toDegrees() method belongs to Java Math class.This method accepts a double and returns a double.This method can handle both positive and negative angles.For reverse conversion, use Math.toRadians() method.Examples of Java Math toDegrees() MethodExample 1: In this example, we will convert the standard radian values to degrees. Java // Java program to demonstrate toDegrees() method import java.lang.Math; public class Geeks { public static void main(String[] args) { double r1 = Math.PI; double r2 = Math.PI / 2; double r3 = Math.PI / 4; System.out.println(Math.toDegrees(r1)); System.out.println(Math.toDegrees(r2)); System.out.println(Math.toDegrees(r3)); } } Output180.0 90.0 45.0 Example 2: In this example, we are trying to convert the negative radians into degrees. Java // Java program to convert negative radians // using toDegrees() method import java.lang.Math; public class Geeks { public static void main(String[] args) { double r = -Math.PI / 2; System.out.println(Math.toDegrees(r)); } } Output-90.0 Explanation: Negative radian is correctly converted into the equivalent negative degree.Example 3: In this example, we will take the user input for radians, and then use toDegrees() method to convert it into the degree. Java // Java program to take user input for radian // then convert into degree import java.util.Scanner; import java.lang.Math; public class Geeks { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter angle in radians: "); double r = sc.nextDouble(); System.out.println("In degrees: " + Math.toDegrees(r)); } } Output: Comment More infoAdvertise with us Next Article TreeSet lower() method in Java B barykrg Follow Improve Article Tags : Java Java-lang package java-math Practice Tags : Java Similar Reads StrictMath toDegrees() Method in Java The java.lang.StrictMath.toDegrees() method of StrictMath class in Java is used to accept an angle measured in radians as a parameter and returns its approximately equivalent angle measured in degrees. So basically it converts radians to degrees. This conversion is generally inexact. Syntax: public 2 min read Java toDegrees() method with Example The toDegrees() method comes under the java.lang.Math package. This method is used to convert an angle from radians to its equivalent degrees. This method is useful in mathematical computations where angle conversion is required, for example, trigonometry, geometry etc.Note: The conversion from radi 2 min read TreeSet lower() method in Java The lower(E ele) method of TreeSet class in Java is used to return the greatest element in this set which is strictly less than the given element. If no such element exists in this TreeSet collection then this method returns a NULL. Here, E is the type of the elements maintained by this collection. 2 min read JavaTuple toList() method The toList() method in org.javatuples is used to convert the values in TupleClass into a List. This List is of Object type, so that it can take all values. It is inherited from the JavaTuple class. This method can be used to any tuple class object of javatuples library. It returns List formed with t 2 min read TreeSet add() Method in Java The Java.util.TreeSet.add() method in Java TreeSet is used to add a specific element into a TreeSet. The function adds the element only if the specified element is not already present in the set else the function return False if the element is not present in the TreeSet. Syntax: Tree_Set.add(Object 1 min read JavaTuple toArray() method The toArray() method in org.javatuples is used to convert the values in TupleClass into an array of Object type. This method is inherited from the JavaTuple class. This method can be used to any tuple class object of javatuples library. It returns an array of Object type formed with the values in th 2 min read TreeSet tailSet() Method in Java The java.util.TreeSet.tailSet() method is used to set a point of start for a tree set, to return all the elements greater than the element passed as parameter mentioned to the method in a sorted manner including the element(if the element is mentioned in the tree). Syntax: TreeSet tail_set.tailSet(O 3 min read Method Class | toGenericString() method in Java The java.lang.reflect.Method.toGenericString() method of Method class returns a string which gives the details of Method, including details of type parameters of the method. Syntax: public String toGenericString() Return Value: This method returns a string which gives the details of Method, includin 3 min read Java TreeSet Special Methods TreeSet is one of the most important implementations of the SortedSet interface in Java that uses a Tree for storage. The TreeSet implements a NavigableSet interface by inheriting AbstractSet class. This means that the elements stored in a TreeSet are in an ordered way, i.e. in the ascending order. 9 min read TreeSet first() Method in Java The Java.util.TreeSet.first() method is used to return the first of the element of a TreeSet. The first element here is being referred to the lowest of the elements in the set. If the elements are of integer types then the smallest integer is returned. If the elements are of the string types then th 3 min read Like