br.com.jhonsapp.bootstrap.object.util.CodeGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bootstrap-object Show documentation
Show all versions of bootstrap-object Show documentation
A complete architecture for creating and managing users.
The newest version!
package br.com.jhonsapp.bootstrap.object.util;
import java.util.Random;
/**
* This class generates a String code based on a random characters quantity.
*
* @author Jhonathan Camacho
*
*/
public class CodeGenerator {
/**
* Generates a code based on a characters quantity.
*
* @param quantity
* the number of characters of the token.
* @return the code generated.
*/
public static String generateCode(int quantity) {
String number = "";
Random generator = new Random();
for (int i = 0; i < quantity; i++) {
number = number + String.valueOf(generator.nextInt(10));
}
return number;
}
}