Adding code for java sample v1