+ 1
How to find square roots in Java?
I am trying to make a prime number generator and I want it efficient. What is the function and are there any tips to make it even more efficient?
2 Réponses
+ 4
Math.sqrt(your_variable)... It returns a double... Here is the Math class docs... You can see all its methods and more
https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html
+ 1
Import the sqrt function from the math class...
import java.lang.Math;
Math.sqrt(double number);