Added basic translation of code to java