org.littleshoot.util
Class BitUtils
java.lang.Object
org.littleshoot.util.BitUtils
public class BitUtils
- extends Object
Utility methods for bit twiddling.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BitUtils
public BitUtils()
toByteArray
public static byte[] toByteArray(int i)
- Returns the bytes (big-endian) of an integer.
- Parameters:
i - The integer.
- Returns:
- A 4-byte array of the bytes of the integer.
toByteArray
public static byte[] toByteArray(long l)
- Converts the specified long to an array of bytes.
- Parameters:
l - The long to convert.
- Returns:
- The array of bytes with the most significant byte first.
byteArrayToInteger
public static int byteArrayToInteger(byte[] b)
byteArrayToInteger
public static int byteArrayToInteger(byte[] b,
int offset)
byteArrayToLong
public static long byteArrayToLong(byte[] b)
byteArrayToLong
public static long byteArrayToLong(byte[] b,
int offset)
Copyright © 2011-2013 LittleShoot. All Rights Reserved.