Updated Java programs: output is now forced to utf-8 encoding. Also made some minor fixes & improvements.