I have a logic intensive algorithm that I need to code in two languages (actually I finished it in one language satisfactorily and am about to start coding in the other language). By logic intensive I mean the algorithm is non trivial, needs careful understanding and, importantly, could be having bugs (due to complexity and carelessness, you know) that would have to be patched in the future.
Also, I want to make sure that when this code changes hands, eventually, it must not overwhelm the new programmers.
Given this scenario, what are some ways that would help maintain the codebases and keep they in sync? By ways I mean software tools, best practices etc.
FYI the two languages are C++ and Java. C++ for Windows/Linux and Java for "everything else" including Android.