The example below show you how to convert an angle measured in radians into degrees and vice versa. We can use the `Math.toDegrees()`

and `Math.toRadians()`

method call to do the conversion.

```
package org.kodejava.example.math;
public class RadiansDegreeConversionExample {
public static void main(String[] args) {
double radians = 1.0d;
double degrees = 45d;
// Converts an angle measured in radians to an
// approximately equivalent angle measured in
// degrees.
double toDegree = Math.toDegrees(radians);
// Converts an angle measured in degrees to an
// approximately equivalent angle measured in
// radians.
double toRadians = Math.toRadians(degrees);
System.out.println("Radians " + radians + " in degrees = " + toDegree);
System.out.println("Degrees " + degrees + " in radians = " + toRadians);
}
}
```

The result of the snippet above are:

```
Radians 1.0 in degrees = 57.29577951308232
Degrees 45.0 in radians = 0.7853981633974483
```

### Wayan Saryada

Founder at Kode Java Org

I am a programmer, a runner, a recreational diver, currently live in the island of Bali, Indonesia. Mostly programming in Java, Spring Framework, Hibernate / JPA. If these posts help, you can support me, buy me a cup of coffee or tea. Thank you 🥳

#### Latest posts by Wayan Saryada (see all)

- How do I set the time of java.util.Date instance to 00:00:00? - October 24, 2019
- How to Install Consolas Font in Mac OS X? - March 29, 2019
- How do I clear the current command line in terminal? - February 14, 2019