class Main {
public static void main
(String args
[]) { long bigDTime, littleDTime;
{
long start
= System.
nanoTime(); for (Double i
= 0.0; i
< 1432143.341; i
+= 0.1) { d += i;
}
bigDTime = end - start;
}
{
long start
= System.
nanoTime(); double d = 0.0;
for (double i = 0.0; i < 1432143.341; i += 0.1) {
d += i;
}
littleDTime = end - start;
System.
out.
println(littleDTime
); }
System.
out.
println("D/d = " + (bigDTime
/ littleDTime
)); }
}
Y2xhc3MgTWFpbiB7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmcgYXJnc1tdKSB7CgkJbG9uZyBiaWdEVGltZSwgbGl0dGxlRFRpbWU7CgoJCXsKCQkJbG9uZyBzdGFydCA9IFN5c3RlbS5uYW5vVGltZSgpOwoJCQlEb3VibGUgZCA9IDAuMDsKCQkJZm9yIChEb3VibGUgaSA9IDAuMDsgaSA8IDE0MzIxNDMuMzQxOyBpICs9IDAuMSkgewoJCQkJZCArPSBpOwoJCQl9CgkJCWxvbmcgZW5kID0gU3lzdGVtLm5hbm9UaW1lKCk7CgkJCWJpZ0RUaW1lID0gZW5kIC0gc3RhcnQ7CgkJCVN5c3RlbS5vdXQucHJpbnRsbihiaWdEVGltZSk7CgkJfQoKCQl7CgkJCWxvbmcgc3RhcnQgPSBTeXN0ZW0ubmFub1RpbWUoKTsKCQkJZG91YmxlIGQgPSAwLjA7CgkJCWZvciAoZG91YmxlIGkgPSAwLjA7IGkgPCAxNDMyMTQzLjM0MTsgaSArPSAwLjEpIHsKCQkJCWQgKz0gaTsKCQkJfQoJCQlsb25nIGVuZCA9IFN5c3RlbS5uYW5vVGltZSgpOwoJCQlsaXR0bGVEVGltZSA9IGVuZCAtIHN0YXJ0OwoJCQlTeXN0ZW0ub3V0LnByaW50bG4obGl0dGxlRFRpbWUpOwoJCX0KCgkJU3lzdGVtLm91dC5wcmludGxuKCJEL2QgPSAiICsgKGJpZ0RUaW1lIC8gbGl0dGxlRFRpbWUpKTsKCX0KfQ==