Java's Math library gives you methods to convert between degrees and radians: toRadians and toDegrees:

public class examples
{
    public static void main(String[] args)
    {
         System.out.println( Math.toRadians( 180 ) ) ;
         System.out.println( Math.toDegrees( Math.PI ) ) ;
    }
}

If your input is in degrees, you need to convert the number going in to sin to radians:

double angle = 90 ;
double result  = Math.sin( Math.toRadians( angle ) ) ;
System.out.println( result ) ;
Answer from Shafik Yaghmour on Stack Overflow
🌐
Baeldung
baeldung.com › home › algorithms › using math.sin with degrees
Using Math.sin with Degrees | Baeldung
January 25, 2024 - We can see this principle in action by taking a look at the Math.sin method, one of the many that Java provides: ... It’s equivalent to the mathematical sine function and it expects its input to be in radians. So, let’s say that we have an angle we know to be in degrees:
🌐
Programiz
programiz.com › java-programming › library › math › sin
Java Math sin()
Note: If the argument is zero, then the result of the sin() method is also zero with the same sign as the argument. import java.lang.Math; class Main { public static void main(String[] args) { // create variable in Degree double a = 30; double b = 45; // convert to radians a = Math.toRadians(a); b = Math.toRadians(b); // print the sine value System.out.println(Math.sin(a)); // 0.49999999999999994 System.out.println(Math.sin(b)); // 0.7071067811865475 // sin() with 0 as its argument System.out.println(Math.sin(0.0)); // 0.0 } } In the above example, we have imported the java.lang.Math package.
🌐
Tutorialspoint
tutorialspoint.com › java › number_sin.htm
Java - sin() Method
June 14, 2023 - public class Test { public static void main(String args[]) { double degrees = 45.0; double radians = Math.toRadians(degrees); System.out.format("The value of pi is %.4f%n", Math.PI); System.out.format("The sine of %.1f degrees is %.4f%n", degrees, Math.sin(radians)); } } This will produce the following result − · The value of pi is 3.1416 The sine of 45.0 degrees is 0.7071 · java_numbers.htm ·
🌐
Codecademy
codecademy.com › docs › java › math methods › .sin()
Java | Math Methods | .sin() | Codecademy
December 17, 2022 - Math.sin(angle) The angle parameter is expressed in radians. The result is in the range [-1, 1]. If the angle is NaN or infinity, NaN is returned. The following example demonstrates the application of .sin() method: // Check.java · public class ...
🌐
Tutorialspoint
tutorialspoint.com › java › lang › number_sin.htm
Java - Math sin() Method
public class Test { public static ... Math.sin(radians)); } } This will produce the following result − · The value of pi is 3.1416 The sine of 0.0 degrees is 0.0000 · java_numbers.htm ·...
🌐
Educative
educative.io › answers › what-is-mathsin-in-java
What is Math.sin() in Java?
The function returns the double ... an equivalent angle measured in radians, we can use the built-in method Math.toRadians(double angle_in_degrees)....
🌐
TutorialKart
tutorialkart.com › java › java-math › java-math-sin
Java Math.sin() - Examples
May 22, 2006 - Java Program · </> Copy · public ...rintln(result); } } Output · 0.479425538604203 · 0.5 radians is approximately equal to 28.6 degrees....
Find elsewhere
🌐
Javatpoint
javatpoint.com › java-math-sin-method
Java Math.sin() Method with Examples - Javatpoint
May 12, 2025 - The java.lang.Math.sin() is used to return the trigonometric sine of an angle. This method returns value between -1 to 1 · We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
🌐
Scaler
scaler.com › home › topics › java math sin()
Java Math sin() | Scaler Topics
April 14, 2024 - The value returned by the function will always be between -1 and 1, representing the range of the sine function. The Java Math sin() returns the trigonometric sine of the specified angle.
🌐
GeeksforGeeks
geeksforgeeks.org › java › trigonometric-functions-in-java-with-examples
Trigonometric Functions in Java with Examples - GeeksforGeeks
May 27, 2019 - Example 1 : Program demonstrating ... sinValue = Math.sin(radians); // prints the sine value System.out.println("sin(" + degrees + ") = " + sinValue); } } Output: sin(45.0) = 0.7071067811865475 ·...
🌐
Vultr Docs
docs.vultr.com › java › standard-library › java › lang › Math › sin
Java Math sin() - Calculate Sine Value | Vultr Docs
May 7, 2025 - This snippet normalizes the angles ... their sine values accordingly. The Math.sin() function in Java is a powerful tool for trigonometric calculations....
🌐
BeginnersBook
beginnersbook.com › 2022 › 10 › java-math-sin-method
Java Math.sin() Method
May 27, 2019 - This angle value is passed as an argument to this method and it returns the sine value ranging from -1 to 1. For example, Math.sin(Math.toRadians(90)) returns 1.0. public class JavaExample { public static void main(String[] args) { double degrees = 90; //conversion degree to radians double ...
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-math-asin-method-example
Java Math asin() Method - GeeksforGeeks
May 7, 2025 - // Java program to convert degrees to radians public class Geeks { public static void main(String[] args) { double degrees = 30.0; double radians = Math.toRadians(degrees); System.out.println("asin(sin30°) in radians: " + Math.asin(Math.sin(radians))); } } Output ·
🌐
Tutorialspoint
tutorialspoint.com › java › lang › math_sin.htm
Java - Math tan(double x) method
December 3, 2024 - package com.tutorialspoint; public class MathDemo { public static void main(String[] args) { // get a double number double x = 45.0; // convert it to radian x = Math.toRadians(x); // print the trigonometric sine for this double System.out.println("Math.sin(" + x + ")=" + Math.sin(x)); } }
🌐
Coderanch
coderanch.com › t › 702651 › java › converting-sin-cos-tan-result
converting a sin/cos/tan result into a degree value (Beginning Java forum at Coderanch)
October 17, 2022 - Taking the sine of it is then taking the sine of the sine, not what you want. If you do take the sine of 0.8, then Java takes this 0.8 to be the angle in radians. The relation between radians and degrees is 2 * Pi radians = 360 degrees So 1 radian is equal (360 / (2 * Pi)) degrees.
🌐
PREP INSTA
prepinsta.com › home › java tutorial › java math sin() method
Java Math sin() Method | prepinsta
July 20, 2023 - public class Main{ public static void main(String[] args) { double angle = Math.toRadians(30); // convert degrees to radians double sine = Math.sin(angle); // calculate sine of angle System.out.println("Sine of 30 degrees: " + sine); } } Sine ...
🌐
Java Tutorial HQ
javatutorialhq.com › java tutorial › java.lang › math › sin() method example
Java Math sin() method example
September 30, 2019 - package com.javatutorialhq.java.examples; import java.util.Scanner; /* * This example source code demonstrates the use of * sin() method of Math class */ public class MathSineExample { public static void main(String[] args) { // Ask for user input System.out.print("Enter an angle in degrees:"); // use scanner to read the console input Scanner scan = new Scanner(System.in); // Assign the user to String variable String s = scan.nextLine(); // close the scanner object scan.close(); // convert the string input to double double value = Double.parseDouble(s); // convert the value to radians double valueRadians = Math.toRadians(value); // get the sine of the angle double sineValue = Math.sin(valueRadians); System.out.println("sine of " + s + " is " + sineValue); } }
🌐
Vultr Docs
docs.vultr.com › java › standard-library › java › lang › Math › asin
Java Math asin() - Get Arc Sine | Vultr Docs
July 20, 2023 - java Copy · double value = 0.5; double radians = Math.asin(value); double degrees = Math.toDegrees(radians); System.out.println("Arc sine of " + value + " in degrees: " + degrees); Explain Code · This code snippet converts the arc sine result ...