You have this problem because of how integer division works in Java:
startE = startE + (((50000 * (13 / 20)) - (50000 * (1 / 2))) / 200);
When you do 13/20
above, it returns 0
because all the values following the decimal point are discarded in int
s. This is equivalent of the floor
in math. When you multiply 50000
with 0
, you get a 0
. Same thing with 1/2
. It becomes 0
and 0
multiplied by anything is 0
.
Your startE
value starts at 25000
. When you add 0
to 25000
you get 25000
. That is the reason you keep seeing 25000
in the loop.