Google is your friend, be nice and visit him often: he can answer queries a lot faster than we can.
A very simple Google gave over half a million hits:
Google "generate random string java"[
^]
In future, please try to do at least basic research yourself, and not waste our time or yours.