Avi12Apr2017,
These examples do just what you are requesting. You fetch the already created user and create a new Editor Project Permission for the User. Once it is created the user will have Editor for the Project.
It is specifically these lines of code:
// Create the new ProjectPermission for the User
JsonObject newProjectPermission = new JsonObject();
newProjectPermission.addProperty("Workspace", workspaceRef);
newProjectPermission.addProperty("Project", projectRef);
newProjectPermission.addProperty("User", userRef);
newProjectPermission.addProperty("Role", PROJECT_EDITOR); // PROJECT_EDITOR was set in a previous part of the code, but it is "Editor"
CreateRequest createProjectPermissionRequest = new CreateRequest("ProjectPermission", newProjectPermission);
CreateResponse createProjectPermissionResponse = restApi.create(createProjectPermissionRequest);
Hope that helps.
Michael