-3

How can I store a number in java that doesn't fit in integer neither in long .

I am trying to find the numbers divisible by 3 between one and a certain number but the problem says that this number is so big that it cannot be stored in an int nor a long.

Basically I am not allowed to store it in an int nor a long so were should i store it?

T.Gounelle
  • 5,953
  • 1
  • 22
  • 32
Sara Chatila
  • 101
  • 1
  • 8

1 Answers1

1

Use java.math.BigInteger that provides arbitrary long integers and methods to operate on them.

T.Gounelle
  • 5,953
  • 1
  • 22
  • 32