com.anthonyeden.lib.util
Class ByteUtilities

java.lang.Object
  extended bycom.anthonyeden.lib.util.ByteUtilities

public class ByteUtilities
extends java.lang.Object

Utility class for working with bytes and byte arrays.

Author:
Anthony Eden

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 byte[] intToByteArray(int value)
          Convert the specified int to a 4 byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

intToByteArray

public static byte[] intToByteArray(int value)
Convert the specified int to a 4 byte array.

Parameters:
value - The value
Returns:
The byte array

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 array
offset - The array offset
Returns:
The integer


Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.