1 | import java.math.BigInteger;
|
2 |
|
3 | public class fibonacci {
|
4 | public static void main(String[] args) {
|
5 | long start = System.currentTimeMillis();
|
6 | BigInteger a = BigInteger.valueOf(1);
|
7 | BigInteger b = BigInteger.valueOf(2);
|
8 | for (int i = 0; i < 100000; i++) {
|
9 | BigInteger c = a.add(b);
|
10 | a = b;
|
11 | b = c;
|
12 | }
|
13 | System.out.println(b.toString().length());
|
14 | System.out.println(String.format("%dms", System.currentTimeMillis() - start));
|
15 | }
|
16 | }
|