How arudino execute commands

  if (i=1000000) current=current2/1000000;

Basic errors there - = is not the equality operator, == is.

1000000 is too large for int, so you should write 1000000L (a long
constant).