Class RandomUtil
- java.lang.Object
-
- hu.icellmobilsoft.coffee.tool.utils.string.RandomUtil
-
public class RandomUtil extends Object
Util class for generating random Strings- Since:
- 1.0.0
- Author:
- imre.scheffer
-
-
Field Summary
Fields Modifier and Type Field Description static char[]ALL_LETTERConstantALL_LETTERstatic StringALL_LETTER_STRINGConstantALL_LETTER_STRING=""static longDATE_2013_01_01ConstantDATE_2013_01_01=1356998400000lstatic intgeneratedIndexConstantgeneratedIndex=0static char[]LOWERCASEConstantLOWERCASEstatic intMAX_NUM_SYSConstantMAX_NUM_SYS=62static intPIDConstantPID=protected static StringPID36ConstantPID36=""protected static StringPID62ConstantPID62=""static char[]UPPERCASEConstantUPPERCASE
-
Constructor Summary
Constructors Constructor Description RandomUtil()Default constructor, constructs a new object.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static StringconvertToRadix(long inNum, long radix)Converts inputlongto any number system.static StringgenerateId()Generates fix 16 length id.protected static StringgenerateToken()Generating randomStringtokenprotected static intgetNextIndex()Generates sequential index.protected static StringpaddL(String str, int length, char padd)Applies left padding to given text.
-
-
-
Field Detail
-
DATE_2013_01_01
public static long DATE_2013_01_01
ConstantDATE_2013_01_01=1356998400000l
-
MAX_NUM_SYS
public static final int MAX_NUM_SYS
ConstantMAX_NUM_SYS=62- See Also:
- Constant Field Values
-
LOWERCASE
public static final char[] LOWERCASE
ConstantLOWERCASE
-
UPPERCASE
public static final char[] UPPERCASE
ConstantUPPERCASE
-
ALL_LETTER
public static final char[] ALL_LETTER
ConstantALL_LETTER
-
ALL_LETTER_STRING
public static final String ALL_LETTER_STRING
ConstantALL_LETTER_STRING=""
-
generatedIndex
public static int generatedIndex
ConstantgeneratedIndex=0
-
PID
public static final int PID
ConstantPID=
-
PID62
protected static final String PID62
ConstantPID62=""
-
PID36
protected static final String PID36
ConstantPID36=""
-
-
Method Detail
-
generateId
public static String generateId()
Generates fix 16 length id.- Returns:
- generated id
-
getNextIndex
protected static int getNextIndex()
Generates sequential index. Restarts sequence when value greater than 1295.- Returns:
- next index
-
paddL
protected static String paddL(String str, int length, char padd)
Applies left padding to given text.- Parameters:
str- text to padlength- pad lengthpadd- pad charachter- Returns:
- left-padded text
-
convertToRadix
protected static String convertToRadix(long inNum, long radix)
Converts inputlongto any number system. Highest available number system is 62.- Parameters:
inNum-longto convertradix- radix of the number system- Returns:
- converted number
String
-
-