initial working code for Java and C++