org.iids.aos.util
Class ByteArrayUtils
java.lang.Object
org.iids.aos.util.ByteArrayUtils
public class ByteArrayUtils
- extends java.lang.Object
Utility methods related to ByteArrays
- Author:
- Michel Oey
|
Method Summary |
static int |
byteArrayToInt(byte[] b)
Convert the byte array to an int. |
static int |
byteArrayToInt(byte[] b,
int offset)
Convert the byte array to an int starting from the given offset. |
static void |
main(java.lang.String[] args)
|
static int |
readInt(byte[] p_src)
|
static byte[] |
toByteArray(int foo)
|
static byte[] |
toByteArray(long foo)
|
static byte[] |
toByteArray(short foo)
|
static void |
writeInt(byte[] p_dest,
int p_toWrite)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NUMBER_OF_BITS_IN_A_BYTE
public static final int NUMBER_OF_BITS_IN_A_BYTE
- Below is an alternative method to convert integers into bytearrays.
This one is supposedly the fastest. Use whichever you like.
- See Also:
- Constant Field Values
MASK_TO_BYTE
public static final short MASK_TO_BYTE
- See Also:
- Constant Field Values
SIZE_OF_AN_INT_IN_BYTES
public static final int SIZE_OF_AN_INT_IN_BYTES
- See Also:
- Constant Field Values
ByteArrayUtils
public ByteArrayUtils()
toByteArray
public static byte[] toByteArray(short foo)
toByteArray
public static byte[] toByteArray(int foo)
toByteArray
public static byte[] toByteArray(long foo)
byteArrayToInt
public static int byteArrayToInt(byte[] b)
- Convert the byte array to an int.
- Parameters:
b - The byte array
- Returns:
- The integer
byteArrayToInt
public static int byteArrayToInt(byte[] b,
int offset)
- Convert the byte array to an int starting from the given offset.
- Parameters:
b - The byte arrayoffset - The array offset
- Returns:
- The integer
writeInt
public static void writeInt(byte[] p_dest,
int p_toWrite)
readInt
public static int readInt(byte[] p_src)
main
public static void main(java.lang.String[] args)
Copyright © 2003, 2004 IIDS Group. All Rights Reserved.