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...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).