When calculating the factorial of 100 (100!) with Java using integers I get 0
factorial, int, java, overflow
Solution
Big negative numbers are values that overflowed into certain ranges; `factorial(100)` has more than 32 binary zeros on the end, so converting it to an integer produces zero.
Problem
When doing this: ``` int x = 100; int result = 1; for (int i = 1; i < (x + 1); i++) { result = (result * i); } System.out.println(result); ``` This is clearly because the result is too big for an integer, but I am used to get big negative numbers for the overflow, and not 0. Thanks in advance! When I switch to this: ``` int x = 100; int result = 1; for (int i = 1; i < (x + 1); i++) { result = (result * i); System.out.println(result); } ``` I get this.