By all means, try to avoid getting arrested. But if you do end up in trouble with the law, remember that you don't have to give police your phone passcode ever. Forcing people to self-incriminate is unconstitutional, which is why a Pennsylvania court just ruled that forcing people to reveal phone passwords violates the Fifth Amendment.
The Securities and Trading Commission wanted two insider trading suspects to turn over the passwords to their work-issued phones as part of its investigation into their alleged crimes, but US District Judge Mark Kearney pointed out that doing so would compel the suspects to self-incriminate:
Since the passcodes to Defendants' work-issued smartphones are not corporate records, the act of producing their personal passcodes is testimonial in nature and Defendants properly invoke their fifth Amendment privilege.
Weirdly enough, while alphanumeric passcodes are protected in this way, phones with fingerprint locks may not be. Last year, in Virginia, a court ruled that suspects didn't have to reveal their passwords -- but they did have to unlock their TouchID-protected phones with their fingerprints, since biometric data isn't protected by the Fifth Amendment.