Redeveloping a C++ program into Java