I came across THIS, but it is too elaborate.
Can someone please suggest how to write a easy and less comprehensive mutable integer wrapper? Or even pointers/steps will help
Why I need a mutable integer? For THIS :
Your question is somewhat abstract. From the other question that you've referenced the issue with your algorithm is that you're attempting to increment a value, however the value is within a method. As Java is pass by value, not pass by reference, the value is mutated within the method but the original value that you've passed into your method (reference) is not touched.
In this case you can make the integer value mutable by just wrapping it within a class, and using getters / setters to modify the value. This is done using 'AtomicInteger' in the previous answer; a simple example of how that's implemented (which is by no means thread-safe or optimal):
public class MutableInt {
private int value;
public MutableInt(int value) { this.value = value; }
public void setValue(int value) { this.value = value; }
public int getValue() { return this.value; }
}