All Packages Class Hierarchy This Package Previous Next Index
Class cynosurex.lang.EnhancedByte
java.lang.Object
|
+----cynosurex.lang.EnhancedByte
- public class EnhancedByte
- extends Object
A enhanced byte class representing the byte
primitive type, including various bit operations.
This class is not an extension to Java 1.1's Byte
class. It remains compatible to Java 1.0.2.
-
B
- The byte.
-
EnhancedByte(byte)
- Constructs and initializes an EnhancedByte with value.
-
areBitsSet(byte, int)
- Checks to see if multi-ple bits are set in the byte.
-
areBitsSet(int)
- Checks to see if multi-ple bits are set in the current
EnhancedByte instance.
-
byteToUnsignedInteger(byte)
- Converts the byte passed in to an unsigned integer.
-
getInteger(byte[])
- Converts the bytes passed in to a signed integer.
-
getLong(byte[])
- Converts bytes to a long integer.
-
getUnsignedInteger(byte[])
- Converts the bytes passed in to an unsigned integer.
-
getUnsignedLong(byte[])
- Converts the bytes passed in to an unsigned long integer.
-
inverse()
- Inverses all the bits in the byte.
-
inverse(byte)
- Inverses all the bits in a byte.
-
inverse(int)
- Inverses all the bits in a integer.
-
inverse(long)
- Inverses all the bits in a long integer.
-
isBitSetAt(byte, int)
- Checks to see if a bit is set in the byte.
-
isBitSetAt(int)
- Checks to see if a bit is set in the current EnhancedByte
instance.
-
setBitAt(byte, int)
- Set a bit of a byte to 1.
-
setBitAt(int)
- Set a bit to 1.
-
setBits(byte, int)
- Set a number of bits to 1.
-
setBits(int)
- Set a number of bits to 1.
-
toString()
- Convert the bits in the byte to String.
-
unSetBitAt(byte, int)
- Set a bit of a byte to 0.
-
unSetBitAt(int)
- Set a bit to 0.
-
unSetBits(byte, int)
- Set a number of bits to 0.
-
unSetBits(int)
- Set a number of bits to 0.
B
protected byte B
- The byte.
EnhancedByte
public EnhancedByte(byte value)
- Constructs and initializes an EnhancedByte with value.
- Parameters:
- value - a value to be assigned to Byte.
isBitSetAt
public boolean isBitSetAt(int pos)
- Checks to see if a bit is set in the current EnhancedByte
instance.
- Parameters:
- pos - the position of the bit within the byte.
0 is the least significant bit, while 7 is the most
significant bit.
isBitSetAt
public static boolean isBitSetAt(byte b,
int pos)
- Checks to see if a bit is set in the byte.
- Parameters:
- b - the byte to be checked.
- pos - the position of the bit within the byte.
0 is the least significant bit, while 7 is the most
significant bit.
areBitsSet
public boolean areBitsSet(int bits)
- Checks to see if multi-ple bits are set in the current
EnhancedByte instance.
- Parameters:
- bits - the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.
areBitsSet
public static boolean areBitsSet(byte b,
int bits)
- Checks to see if multi-ple bits are set in the byte.
- Parameters:
- b - the byte to be checked.
- bits - the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.
setBitAt
public void setBitAt(int pos)
- Set a bit to 1.
- Parameters:
- pos - the position of the bit to be set.
0 is the least significant bit, while 7 is the most
significant bit.
unSetBitAt
public void unSetBitAt(int pos)
- Set a bit to 0.
- Parameters:
- pos - the position of the bit to be set.
0 is the least significant bit, while 7 is the most
significant bit.
setBitAt
public static byte setBitAt(byte b,
int pos)
- Set a bit of a byte to 1.
- Parameters:
- b - the byte to be set.
- pos - the position of the bit to be set.
0 is the least significant bit, while 7 is the most
significant bit.
unSetBitAt
public static byte unSetBitAt(byte b,
int pos)
- Set a bit of a byte to 0.
- Parameters:
- b - the byte to be set.
- pos - the position of the bit to be set.
0 is the least significant bit, while 7 is the most
significant bit.
setBits
public void setBits(int bits)
- Set a number of bits to 1.
- Parameters:
- bits - the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.
unSetBits
public void unSetBits(int bits)
- Set a number of bits to 0.
- Parameters:
- bits - the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.
setBits
public static byte setBits(byte b,
int bits)
- Set a number of bits to 1.
Primitive byte is not pass-by-reference, therefore, the modified value is returned.
- Parameters:
- b - the byte to be set.
- bits - the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.
unSetBits
public static byte unSetBits(byte b,
int bits)
- Set a number of bits to 0.
Primitive byte is not pass-by-reference, therefore, the modified value is returned.
- Parameters:
- b - the byte to be set.
- bits - the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.
getLong
public static long getLong(byte w[])
- Converts bytes to a long integer.
- Parameters:
- w - an array of bytes. The maximum number of byte
elements is 8 (Java defines 64 bit long integers).
Highest byte in the array is the most significant byte.
Lowest byte in the array is the least significant byte.
getUnsignedLong
public static long getUnsignedLong(byte w[])
- Converts the bytes passed in to an unsigned long integer.
Note that Java does not support unsigned integer;
an overflow may occur and NumberFormatException is thrown.
- Parameters:
- w - an array of bytes. The maximum number of byte
elements is 8 (Java defines 64 bit long integers).
Highest byte in the array is the most significant byte.
Lowest byte in the array is the least significant byte.
getInteger
public static int getInteger(byte w[])
- Converts the bytes passed in to a signed integer.
Use the method getLong () for large integers.
- Parameters:
- w - an array of bytes. The maximum number of byte
elements is 4 (Java defines 32 bit integers).
Highest byte in the array is the most significant byte.
Lowest byte in the array is the least significant byte.
getUnsignedInteger
public static int getUnsignedInteger(byte w[])
- Converts the bytes passed in to an unsigned integer.
Note that Java does not support unsigned integer;
an overflow may occur and NumberFormatException is thrown.
Use the method getLong () for large integers.
- Parameters:
- w - an array of bytes. The maximum number of byte
elements is 4 (Java defines 32 bit integers).
Highest byte in the array is the most significant byte.
Lowest byte in the array is the least significant byte.
byteToUnsignedInteger
public static int byteToUnsignedInteger(byte b)
- Converts the byte passed in to an unsigned integer.
- Parameters:
- b - the byte to be converted
inverse
public void inverse()
- Inverses all the bits in the byte.
inverse
public static byte inverse(byte b)
- Inverses all the bits in a byte.
- Parameters:
- b - the byte to be changed
inverse
public static int inverse(int i)
- Inverses all the bits in a integer.
- Parameters:
- i - the integer to be changed
inverse
public static long inverse(long l)
- Inverses all the bits in a long integer.
- Parameters:
- l - the long integer to be changed
toString
public String toString()
- Convert the bits in the byte to String.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index