Like other people already said it's probably an integer overflow.
Java uses 4 Bytes for Integers. And the number range is from -2147483648 to 2147483647.
Like other people suggest u can use long wich uses 8 Bytes. The Range is from -9223372036854775808 to 9223372036854775807.
Also in other languages like C# also exist unsigned numbers like uInt. They are only positive numbers wich gives them a range from 0 and double of the positive numbers.
Just look up primitive data types in your language.