JAVA code to update Keycloak User profile

All: I’m looking for a sample Java code to update certain fields (e.g. email) in an existing Keycloak realm using Admin privileges. If anyone have it handy, please pass it along. Or any Java reference links would be helpful to. Thanks!

Found the Java code to update Keycloak user profile details. Please find it below.
import UsersResource, UserResource and UserRepresentation packages

public void updateUser (UsersResource usersResource, UserRepresentation user) {

	// Initialize User Representation List with
	//  the specific user details by searching with e-mail or relevant
	List<UserRepresentation> userReps =  usersResource.search(user.getEmail());
	UserRepresentation userRep = userReps.get(0);
	UserResource userResource = usersResource.get(userRep.getId());
	userResource.update(user); // update the user profile with the details 
}