com.myjavaworld.util
Class RandomKeyGenerator
java.lang.Object
com.myjavaworld.util.RandomKeyGenerator
public class RandomKeyGenerator
- extends Object
- Author:
- Sai Pullabhotla, psai [at] jMethods [dot] com
Method Summary |
static String |
formatKey(String key)
Formats a string. |
static String |
generate(int length)
Generates a random string with the given length.This method uses only the
UPPER case alphabets and numbers from 0-9 to generate the random string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RandomKeyGenerator
public RandomKeyGenerator()
generate
public static String generate(int length)
- Generates a random string with the given length.This method uses only the
UPPER case alphabets and numbers from 0-9 to generate the random string.
- Parameters:
length
- length of the random string
- Returns:
- Random string with the specified length.
formatKey
public static String formatKey(String key)
- Formats a string. All this method does is inserts a hyphen (-) after
every 4 characters in the given input.
- Parameters:
key
- Key to format
- Returns:
- Formatted key.
Copyright © 2000-2012 jMethods, Inc.. All Rights Reserved.