Is there a working sample code one can share to perform upload using v1 java sdk?
I don't believe we have a chunked uploading sample for the API v1 Java SDK, but API v1 is deprecated anyway, so you should migrate off of it whenever possible.
You should use the API v2 Java SDK. Here's a sample of chunked uploading a.k.a. upload sessions.