user2507230
user2507230

Reputation: 560

Add AtomicLong to AtomicLong?

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

Answers (1)

Louis Wasserman
Louis Wasserman

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

Related Questions