Added Java version

Since it was based on Java, I'm adding the original Java version,
reformatted for this repo
Grammar check and demotion of comment

removed one word "object" and changed comment from doc to block