Java – how to parse a big integer from a string?

java

I have a method like this:

Integer.parseInt(myInt)

not this integer becomes to long and I'm getting the following exception:

java.lang.NumberFormatException: For input string: "4000123012"

what can I do to avoid this error and still keep alle the functions runnning?

I tried to use BigInteger but there is no parse method, or I did not found it.

Best Answer

Use it like this.

 BigInteger number = new BigInteger(myInt);