Actually, you want to do that immediately after purchasing a new hat, not just when washing it. Roll the brim of the hat, placing it inside a coffee cup. It's best to leave it in there for at least 12 hours before wearing it.
"In this present crisis, government is not the solution to our problem - government IS the problem." - Ronald Reagan
Comments made here are my own and are not intended to represent the official position of Alaska Air Group