Add final method tojava(). Need to add comments and error check.