oracle.jbo.common
Class RepConversion
java.lang.Object
|
+--oracle.jbo.common.RepConversion
- public class RepConversion
- extends java.lang.Object
Numbers' representation conversion/manipulation routines.
- Version:
- 1.0 - 1/24/97
- See Also:
Type | Method |
static byte |
asciiHexToNibble(byte b)
Converting an ascii nibble in decimal ( [0-9a-f-A-F] should be in the
hex range) to a 4 bit number which is the hex value (nibble). |
static void |
bArray2nibbles(byte[] array,
byte[] nibbles)
Byte array to nibbles. |
static java.lang.String |
bArray2String(byte[] array)
Byte array to String. |
static byte[] |
convertHexStringToByte(java.lang.String refString)
|
static byte[] |
nibbles2bArray(byte[] nibbles)
Nibbles to byte array. |
static byte |
nibbleToHex(byte nibble)
nibble To hex. |
static void |
printInHex(byte b)
print byte in Hex. |
static void |
printInHex(int value)
|
static void |
printInHex(long value)
|
static void |
printInHex(short value)
|
static byte[] |
toHex(int value)
|
static byte[] |
toHex(long value)
|
static byte[] |
toHex(short value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RepConversion
public RepConversion()
printInHex
public static void printInHex(byte b)
- print byte in Hex.
Takes a byte as an argument and prints its value in Hex. For example
the number 255 will print FF with no new line.
- Parameters:
b
- byte to convert to hex
nibbleToHex
public static byte nibbleToHex(byte nibble)
- nibble To hex.
This will take a nibble (4 low bits of the byte passed) and
convert it into the Hex value. If the value of nibble
is greater than 4 bits, the 4 high bits will be filtered.
- Parameters:
nibble
- Byte with a 4 bit value to convert to Hex.- Returns:
-
asciiHexToNibble
public static byte asciiHexToNibble(byte b)
- Converting an ascii nibble in decimal ( [0-9a-f-A-F] should be in the
hex range) to a 4 bit number which is the hex value (nibble).
The ascii value passed should be in the range of [a-fA-F0-9]. There is
a catch for this function, if the value passed can not be converted
to Hex, because it is not within this ascii range [a-fA-F0-9] the
result will be the same value passed from the user. We may change
later to raise an exception in this case.
nibble of the result
- Parameters:
b
- byte with a hex value to convert to decimal- Returns:
- converted value of 4 bits (if not an error)
bArray2nibbles
public static void bArray2nibbles(byte[] array,
byte[] nibbles)
- Byte array to nibbles.
Takes an array of bytes and converts it into an array of nibbles.
The nibbles array must be at least double the size of array.
- Parameters:
array
- array of bytes to convertnibbles
- array where the nibbles will be stored
bArray2String
public static java.lang.String bArray2String(byte[] array)
- Byte array to String.
Takes an array of bytes and converts it into a String containing
its hex reprenstation.
- Parameters:
array
- array of bytes to convert
nibbles2bArray
public static byte[] nibbles2bArray(byte[] nibbles)
- Nibbles to byte array.
Puts an array of nibbles into an array of bytes (2 nibbles per byte)
- Parameters:
nibbles
- array of nibbles- Returns:
- array array of bytes
printInHex
public static void printInHex(long value)
printInHex
public static void printInHex(int value)
printInHex
public static void printInHex(short value)
toHex
public static byte[] toHex(long value)
toHex
public static byte[] toHex(int value)
toHex
public static byte[] toHex(short value)
convertHexStringToByte
public static byte[] convertHexStringToByte(java.lang.String refString)