Are you saying that you were unable to use the Python sample to upload your media file, or that you were unable to convert the logic to a Java version?
There’s a patch for Twitter4J here that adds chunked media upload capability but I don’t think it has been merged into the main branch yet.