In my opinion, this question is off-topic. It is asking for translating C++ code into Java. In addition to this point, it is also a mix of low quality and lack of clarity.
Because of these reasons, I flagged the question for moderator attention:
This question is off-topic (translating C++ code to Java), but I can't vote to close because it has a bounty on it.
The flag got declined with the following statement:
That doesn't make a question off-topic. Low quality perhaps but not explicitly off-topic
I improved some of the formatting problems. But my question remains the same: Is asking for translating code from one language to another on-topic?
If there wasn't a bounty on the question, I would have closed it as off-topic or too broad (give me teh codez).