|
Java Card v2.2.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavacardx.framework.math.BCDUtil
public final class BCDUtil
The BCDUtil
class contains common BCD(binary coded decimal) related utility functions.
This class supports Packed BCD format. All methods in this class are static.
The BCDUtil
class only supports unsigned numbers whose value
can are represented in hexadecimal format using an implementation
specific maximum number of bytes.
Constructor Summary | |
---|---|
BCDUtil()
|
Method Summary | |
---|---|
static short |
convertToBCD(byte[] hexArray,
short bOff,
short bLen,
byte[] bcdArray,
short outOff)
Converts the input hexadecimal data into BCD format. |
static short |
convertToHex(byte[] bcdArray,
short bOff,
short bLen,
byte[] hexArray,
short outOff)
Converts the input BCD data into hexadecimal format. |
static short |
getMaxBytesSupported()
This method returns the largest value that can be used with the BCD utility functions. |
static boolean |
isBCDFormat(byte[] bcdArray,
short bOff,
short bLen)
Checks if the input data is in BCD format. |
Methods inherited from class java.lang.Object |
---|
equals |
Constructor Detail |
---|
public BCDUtil()
Method Detail |
---|
public static short getMaxBytesSupported()
public static short convertToHex(byte[] bcdArray, short bOff, short bLen, byte[] hexArray, short outOff)
Note:
bOff
or bLen
or outOff
parameter
is negative an ArrayIndexOutOfBoundsException
exception is thrown.
bOff+bLen
is greater than bcdArray.length
, the length
of the bcdArray
array a ArrayIndexOutOfBoundsException
exception is thrown
and no conversion is performed.
hexArray.length
, the length
of the hexArray
array an ArrayIndexOutOfBoundsException
exception is thrown
and no conversion is performed.
bcdArray
or hexArray
parameter is null
a NullPointerException
exception is thrown.
bcdArray
and hexArray
arguments refer to the same array object,
then the conversion is performed as if the components at positions bOff
through bOff+bLen-1
were first copied to a temporary array with bLen
components
and then the contents of the temporary array were converted into
positions outOff
onwards for the converted bytes of the output array.
bcdArray
- input byte arraybOff
- offset within byte array containing first byte (the high order byte)bLen
- byte length of input BCD datahexArray
- output byte arrayoutOff
- offset within hexArray where output data begins
ArrayIndexOutOfBoundsException
- if converting would cause access of data outside array bounds
or if bLen
is negative
NullPointerException
- if either bcdArray
or hexArray
is null
ArithmeticException
- for the following conditions:bLen
is 0
public static short convertToBCD(byte[] hexArray, short bOff, short bLen, byte[] bcdArray, short outOff)
Note:
bOff
or bLen
or outOff
parameter
is negative an ArrayIndexOutOfBoundsException
exception is thrown.
bOff+bLen
is greater than hexArray.length
, the length
of the hexArray
array a ArrayIndexOutOfBoundsException
exception is thrown
and no conversion is performed.
bcdArray.length
, the length
of the bcdArray
array an ArrayIndexOutOfBoundsException
exception is thrown
and no conversion is performed.
bcdArray
or hexArray
parameter is null
a NullPointerException
exception is thrown.
bcdArray
and hexArray
arguments refer to the same array object,
then the conversion is performed as if the components at positions bOff
through bOff+bLen-1
were first copied to a temporary array with bLen
components
and then the contents of the temporary array were converted into
positions outOff
onwards for the converted bytes of the output array.
hexArray
- input byte arraybOff
- offset within byte array containing first byte (the high order byte)bLen
- byte length of input hex databcdArray
- output byte arrayoutOff
- offset within bcdArray where output data begins
ArrayIndexOutOfBoundsException
- if converting would cause access of data outside array bounds
or if bLen
is negative
NullPointerException
- if either bcdArray
or hexArray
is null
ArithmeticException
- for the following conditions:bLen
is 0
public static boolean isBCDFormat(byte[] bcdArray, short bOff, short bLen)
bcdArray
- input byte arraybOff
- offset within byte array containing first byte (the high order byte)bLen
- byte length of input BCD data
ArrayIndexOutOfBoundsException
- if accessing the input array would cause access of data outside array bounds
or if bLen
is negative
NullPointerException
- if bcdArray
is null
ArithmeticException
- if bLen
is 0
|
Java Card v2.2.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |