added stdin/out version (java)