MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / fibUpToLongMax

Method fibUpToLongMax

test/test/proc/BasicApp.java:16–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 private static final Random random = new Random();
15
16 public static long[] fibUpToLongMax() {
17 List<Long> tmp = new ArrayList<>();
18
19 long a = 0L;
20 long b = 1L;
21 tmp.add(a);
22 tmp.add(b);
23
24 while (true) {
25 try {
26 long next = Math.addExact(a, b);
27 tmp.add(next);
28 a = b;
29 b = next;
30 } catch (ArithmeticException overflow) {
31 break;
32 }
33 }
34
35 long[] result = new long[tmp.size()];
36 for (int i = 0; i < tmp.size(); i++) {
37 result[i] = tmp.get(i);
38 }
39 return result;
40 }
41
42 public static void main(String[] args) throws Exception {
43 while (true) {

Callers 1

mainMethod · 0.95

Calls 3

addMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected