Implemented tests for Java reverse logic