assignments from C++, but written by java