Java version
Done