Added java implementation