Java Math.toDegrees(double angrad)

Syntax

Math.toDegrees(double angrad) has the following syntax.

public static double toDegrees(double angrad)

Example

In the following code shows how to use Math.toDegrees(double angrad) method.


//  w  ww  .ja  va  2s .  c o m
public class Main {

   public static void main(String[] args) {

      double x = 0.5;
      double y = -1;

      // convert them in degrees
      x = Math.toDegrees(x);
      y = Math.toDegrees(y);

      System.out.println(x);
      System.out.println(y);

   }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable