added more test cases and java docs