All Downloads are FREE. Search and download functionalities are using the official Maven repository.

simple.token.SimpleTokenGenerator Maven / Gradle / Ivy

Go to download

This project provides util classes that facilitate loading properties file, verify string conditions ans cep validation.

The newest version!
package simple.token;

import java.util.Random;

/**
 * This class generates a String token based on a random characters quantity.
 * 
 * @author Jhonathan Camacho
 *
 */
public class SimpleTokenGenerator {

	/**
	 * Generates a token based on a characters quantity.
	 * 
	 * @param quantity
	 *            the number of characters of the token.
	 * @return the token generated.
	 */
	public static String generateToken(int quantity) {
		String number = "";

		Random generator = new Random();

		for (int i = 0; i < quantity; i++) {
			number = number + String.valueOf(generator.nextInt(10));
		}
		return number;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy