Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sqrt
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { long time = System.currentTimeMillis(); String total = ""; for (int i = 0; i < 50000000; i++) { total = ""+sqrt(4); } System.out.println("\n\n" + (System.currentTimeMillis() - time)); } public static float sqrt(int n) { float t; float sqrt = n * 0.5f; do { t = sqrt; sqrt = (t + (n / t)) * 0.5f; } while (t != sqrt); return sqrt; } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
bookstore
Java messing around
"Naive" recursion vs. Dynamic Programming
My date and time
evenloop
Problem: fb_series
vsecodertest2
some string reverse in java
Borrowing class
Edna Garcia
Please log in to post a comment.