java - passcode validation
===

In my web application I have the following requirement. I have the following constraints while setting the passcode(password) when the user signup first time.

1. Passcode should containn 6 digits. (Eg 132715)
2. Only numbers can be entered
3. No ascending/descending numbers allowed (Eg 123456, 654321 - not allowed)
4. 3 (or more) same number cannot be repeated (Eg 121715, 232254 - not allowed).

Can anyone please clarify if this can be done through Regular Expression or is it better to implement through java. If possible can anyone please provide me a sample code?