When you write int i = 0, it does not create garbage.
A variable ihas a type intthat is a primitive type, not a type of object (or reference). The state is iheld entirely inside the stack frame of the attached method; those. not on the heap.
Does this create a lot of garbage?
No.
And will there be an alternative?
...