I'm trying to assign values in the billion range to two LONG variables. The message I get from the compiler is:
"Integer number too large", in reference to the two large numbers I try to assign. Now, long integers can hold values much larger than the ones I'm trying to assign. So why am I getting this error? THANKS!
.....................................
class PseudoRandom {
public static void main (String[] args) {
long a = 3141592621, m = 10000000000;
int c = 1;
for (int x = 1; x <= 101; x++) {
System.out.println(x);
x = (a * x + c) % m;
}
}
}
"Integer number too large", in reference to the two large numbers I try to assign. Now, long integers can hold values much larger than the ones I'm trying to assign. So why am I getting this error? THANKS!
.....................................
class PseudoRandom {
public static void main (String[] args) {
long a = 3141592621, m = 10000000000;
int c = 1;
for (int x = 1; x <= 101; x++) {
System.out.println(x);
x = (a * x + c) % m;
}
}
}