Reputation: 560
I'm creating a program to create the Fibonacci sequence, but it keeps messing up because longs can't contain it for very long. I'm trying to switch to AtomicLongs, but I cannot add a atomiclong to an atomiclong, only a regular long? How can I do this, or would it be better to do something more dynamic, like adding two arrays of bytes?
Upvotes: 0
Views: 468
Reputation: 198211
AtomicLong
is just a long
with some extra thread-safe properties; the set of numbers it can store is exactly equal to the set of numbers a long
can store.
You want a BigInteger
.
Upvotes: 4