@LevelUpApi(contract=INTERNAL) public final class CodeVersionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isValidCode(String code,
int expectedLength,
int codeVersionStartIndex,
int codeVersionEndIndex,
int expectedVersion)
Utility method to check validity of the provided code.
|
static String |
leftPadWithZeros(String toPad,
int finalSize)
Left pads a string with zeros.
|
public static boolean isValidCode(String code, int expectedLength, int codeVersionStartIndex, int codeVersionEndIndex, int expectedVersion)
code
- the code string to check.expectedLength
- the length the code must be.codeVersionStartIndex
- the start index (INCLUSIVE) to get the code version from.codeVersionEndIndex
- the end index (EXCLUSIVE) to get the code version from.expectedVersion
- the version code that the code's version should be checked against.public static String leftPadWithZeros(String toPad, int finalSize)
toPad
- the string to pad with zeros.finalSize
- the required size of the string. (cannot be negative)IllegalArgumentException
- if finalSize is negative.