How to generate a random alpha-numeric string (sequence ) in Java


                                                                                          

For generating random alpha-numeric string you can use following Apache class   
  org.apache.commons.lang.RandomStringUtils

 String r = RandomStringUtils.randomAlphanumeric(32); // for 32 random alpha-numeric sequence

similarly, you can get  whatever sequence  you want.
For more details about the org.apache.commons.lang.RandomStringUtils  class visit this link:
http://commons.apache.org/lang/api-2.5/org/apache/commons/lang/RandomStringUtils.html
 

 
Share on Google Plus

About JK STACK

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment