-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathproblem_25.java
More file actions
26 lines (22 loc) · 1.49 KB
/
problem_25.java
File metadata and controls
26 lines (22 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.math.BigInteger;
class Problem25
{
public static void main(String[] args)
{
long begin = System.currentTimeMillis();
BigInteger a = BigInteger.valueOf(1);
BigInteger b = BigInteger.valueOf(2);
BigInteger c = BigInteger.valueOf(0);
BigInteger MAX = new BigInteger("1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
int i = 3;
for (i = 3; b.compareTo(MAX) < 0; i++)
{
c = a.add(b);
a = b;
b = c;
}
System.out.println("index is : " + i);
long end = System.currentTimeMillis();
System.out.println(end - begin + "ms");
}
}