I am writing a new Android application that require the users to register and the system need to send emails to give them a code for email verification.
The random code need to be a 6-digit code that consisting numbers with uppercase alphabet, for example, 6H94BA. I have done some research and still cannot find anything. How to do that?
Try this:
SecureRandom random = new SecureRandom();
String randomCode = new BigInteger(30, random).toString(32).toUpperCase();