In recursivity, there's anyway to keep some value for all the internal called recursive methods?
I am iterating a String inside some method, when I find an specific character I send it inside the same method by recursivity and return only when it finds other character of finalization. The problem is that I need that count of iterations, did inside this methods for the superior method in the hierarchy, I am sending it with the return, but, I think it's not elegant..
Can I use static values for it (I add count inside, and when it goes to the superior method it keeps this value)?