You can convert any float or double to an int with a cast. For example:

int integerResult = (int)Math.sin(variable);

However, this really does not make sense. Since the result of Math.sin() will always be from -1 to 1, this cast will always make the result 0 or -1 or 1. From the sound of your question you're not very sure about how to use these. I would strongly recommend you brush up on your math skills before attempting anything too complicated with your programming. You can, of course, use these in floating point format instead of as an integer.

Your second question. 9 * 9 * 9 is equivalent to 9 cubed. You could make your own method for the clearest intent:

int cube(int input) {
    //return the input cubed
    return input*input*input;
}

Or use the built in function Math.pow() like so:

float nineCubed = Math.pow(9,3);

You can see check the java doc to see what functions Java has built in for math.

Finally, you can check out some of these math resources:

What math should all game programmers know?

Linear algebra for game developers part 1

Answer from House on Stack Exchange
🌐
W3Schools
w3schools.com › java › ref_math_sin.asp
Java Math sin() Method
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... System.out.println(Math.sin(3)); System.out.println(Math.sin(-3)); System.out.println(Math.sin(0)); System.out.println(Math.sin(Math.PI)); System.out.println(Math.sin(Math.PI/2));
🌐
Reddit
reddit.com › r/java › differences between math.sin() and strictmath.sin()
r/java on Reddit: Differences between Math.sin() and StrictMath.sin()
June 29, 2013 -

...besides the obvious? So a couple years ago I was working on a hobby project and I had to use sin() a lot (it could be several billions of calls). So I was looking at ways to speed it up. One of the things I did was to look at the source. Math.sin's (which I was using) body was:
public static double sin(double a)
{
return StrictMath.sin(a);
}

So I thought, why not just use StrictMath.sin() instead and save a call/return? Turns out the execution time increased, every time. I asked my professor and he didn't know. So I asked the java forums, and I never got a definite answer. So now I figure I'll ask here as the thought came up. Does anyone know? I assume there's some trickery going on (like the source for Math.java isn't the actual implementation or some such).

Discussions

mathematics - How do I convert sin, cos and tan into an int in Java? - Game Development Stack Exchange
How would you be able to change Math.sin, Math.cos and Math.tan into an int? This is because I heard that it is useful to have those Math resources in movement, gravity, etc. in gaming. Also, as a ... More on gamedev.stackexchange.com
🌐 gamedev.stackexchange.com
June 17, 2012
Java has a "sine" computing function: Math.sin(#). To use it, you replace # by some value specifying an angle measured in radians. Programmers can use Java's Math.sin function when they need to compute a sine value. But, what if Java didn't have Math.sin? Or, what if YOU are the programmer who is asked to write the program code for Math.sin? What would
Answer to Java has a "sine" computing function: Math.sin(#). More on chegg.com
🌐 chegg.com
1
July 11, 2022
math - How is sine implemented in Java? - Stack Overflow
I found this question about sin in Java, but that's asking why the sin function isn't wrapped in native code. I'm asking something entirely different. I want to know how the function was implemented. (Since it's wrapped in native code, I can't see it.) Did they simply implement it from the Taylor series expansion: ... I can't look at the code for the Math... More on stackoverflow.com
🌐 stackoverflow.com
Differences between Math.sin() and StrictMath.sin()
JVM generates native platform specific code in Math. Modern processors have separate instructions for many trigonometry functions, those are much faster. JVM makes use of them if possible. StrictMath is the "default" if those native don't exist. And it does the math in software. (hence the slower runtime) More on reddit.com
🌐 r/java
12
38
June 29, 2013
🌐
Vultr Docs
docs.vultr.com › java › standard-library › java › lang › Math › sin
Java Math sin() - Calculate Sine Value | Vultr Docs
December 3, 2024 - The Math.sin() method in Java is an essential function that calculates the sine of a specified angle.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-math-sin-method-examples
Java Math sin() method with Examples - GeeksforGeeks
July 11, 2025 - // Java program to demonstrate working // of java.lang.Math.sin() method import java.lang.Math; class Gfg { // driver code public static void main(String args[]) { double a = 30; // converting values to radians double b = Math.toRadians(a); System.out.println(Math.sin(b)); a = 45; // converting values to radians b = Math.toRadians(a); System.out.println(Math.sin(b)); a = 60; // converting values to radians b = Math.toRadians(a); System.out.println(Math.sin(b)); a = 90; // converting values to radians b = Math.toRadians(a); System.out.println(Math.sin(b)); } }
🌐
Quora
quora.com › How-do-you-calculate-the-sin-value-in-Java
How to calculate the sin value in Java - Quora
Answer (1 of 2): First off, if you’re not referring to the function sin() then you should spell it correctly as sine to avoid unnecessary religious jokes. That aside, I alread see an answer referring you to the default Math package thats included with Java, so I’m going to take a different appro...
Find elsewhere
🌐
BeginnersBook
beginnersbook.com › 2022 › 10 › java-math-sin-method
Java Math.sin() Method
October 17, 2022 - Java Math.sin() method returns the trigonometric sine of the given angle in radians. This angle value is passed as an argument to this method and it returns the sine value ranging from -1 to 1.
🌐
GeeksforGeeks
geeksforgeeks.org › java › trigonometric-functions-in-java-with-examples
Trigonometric Functions in Java with Examples - GeeksforGeeks
May 27, 2019 - Java.lang.Math.sin() Method : is an inbuilt method which returns the sine of the value passed as an argument. The value passed in this function should be in radians. If the argument is NaN or an infinity, then the result is NaN.
🌐
Sarthaks eConnect
sarthaks.com › 3497550 › explain-java-math-sin-method
Explain Java Math sin() Method - Sarthaks eConnect | Largest Online Education Community
April 29, 2023 - LIVE Course for free · The Java Math sin() method is a built-in function that calculates the sine of a given angle in radians. The sin() method belongs to the java.lang.Math class and takes a single argument of type double, which represents ...
🌐
Codecademy
codecademy.com › docs › java › math methods › .sin()
Java | Math Methods | .sin() | Codecademy
December 17, 2022 - The Math.sin() method returns the trigonometric sine of an angle argument, given in radians. ... Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
🌐
Educative
educative.io › answers › what-is-mathsin-in-java
What is Math.sin() in Java?
Java has a built-in Math class, defined in the java.lang package, which contains important functions to perform basic mathematical operations. The class has the sin() method, which is used to compute a specified angle’s trigonometric sine.
🌐
Tutorialspoint
tutorialspoint.com › java › lang › number_sin.htm
Java - Math sin() Method
This method returns the sine of the specified double value. In this example, we're showing the usage of Math.sin() method to get the sin of a double number. We've created a double variable x and initialized it with a given angle.
🌐
PREP INSTA
prepinsta.com › home › java tutorial › java math sin() method
Java Math sin() Method | prepinsta
July 20, 2023 - Java Math sin() Method returns the trigonometric sine of an angle. If the argument is NaN or an infinity, then the result is NaN.
🌐
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 } }
🌐
W3Schools
w3schools.com › jsref › jsref_sin.asp
W3Schools.com
The Math.sin() method returns the sine of a number.
🌐
Sololearn
sololearn.com › en › Discuss › 2011477 › what-is-it-and-what-is-the-use-of-the-math-class-in-java
What is it and what is the use of the math class in Java? | Sololearn: Learn to code for FREE!
All modules are free to use of course, the math module helps you use math functions, like sin, cos, sqrt, and other useful functions, instead of having to write them yourself ... Excuse me, I didn't understand your answer. Could it be spesified better? ... A simple google research: https://www.google.com/amp/s/www.geeksforgeeks.org/java-lang-math-class-in-java-set-1/amp/
🌐
Baeldung
baeldung.com › home › algorithms › using math.sin with degrees
Using Math.sin with Degrees | Baeldung
January 25, 2024 - In this short tutorial, we’ll look at how to calculate sine values using Java’s Math.sin() function and how to convert angle values between degrees and radians.