Password Policy

I’ve been using Keycloak as Auth system. I’ve configured password policies in the Keycloak Admin Console, those policies are applicable when I try to update the password in the user Account however when I’m creating a user thru Java code, those policies are ignored.
Do you have an idea how am I suppose to get those policies and test if a password is valid on those policies?