Added Ptr<T> support to Java wrappers
Merge pull request #3180 from mshabunin:java_ptr_support