|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcynosurex.lang.EnhancedByte
public class EnhancedByte
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.
Field Summary | |
---|---|
protected byte |
B
The byte. |
Fields inherited from interface cynosurex.internal.CommonInterface |
---|
copyright, copyrightYears, notice, program, version |
Fields inherited from interface cynosurex.internal.AuthorCommon |
---|
author, copyrightSymbol, noticeMsg, rights |
Fields inherited from interface cynosurex.internal.CompanyCommon |
---|
company, email, website |
Constructor Summary | |
---|---|
EnhancedByte(byte value)
Constructs and initializes an EnhancedByte with value. |
Method Summary | |
---|---|
static boolean |
areBitsSet(byte b,
int bits)
Checks to see if multi-ple bits are set in the byte. |
boolean |
areBitsSet(int bits)
Checks to see if multi-ple bits are set in the current EnhancedByte instance. |
static int |
byteToUnsignedInteger(byte b)
Converts the byte passed in to an unsigned integer. |
static int |
getInteger(byte[] w)
Converts the bytes passed in to a signed integer. |
static long |
getLong(byte[] w)
Converts bytes to a long integer. |
static int |
getUnsignedInteger(byte[] w)
Converts the bytes passed in to an unsigned integer. |
static long |
getUnsignedLong(byte[] w)
Converts the bytes passed in to an unsigned long integer. |
void |
inverse()
Inverses all the bits in the byte. |
static byte |
inverse(byte b)
Inverses all the bits in a byte. |
static int |
inverse(int i)
Inverses all the bits in a integer. |
static long |
inverse(long l)
Inverses all the bits in a long integer. |
static boolean |
isBitSetAt(byte b,
int pos)
Checks to see if a bit is set in the byte. |
boolean |
isBitSetAt(int pos)
Checks to see if a bit is set in the current EnhancedByte instance. |
static byte |
setBitAt(byte b,
int pos)
Set a bit of a byte to 1. |
void |
setBitAt(int pos)
Set a bit to 1. |
static byte |
setBits(byte b,
int bits)
Set a number of bits to 1. |
void |
setBits(int bits)
Set a number of bits to 1. |
java.lang.String |
toString()
Convert the bits in the byte to String. |
static byte |
unSetBitAt(byte b,
int pos)
Set a bit of a byte to 0. |
void |
unSetBitAt(int pos)
Set a bit to 0. |
static byte |
unSetBits(byte b,
int bits)
Set a number of bits to 0. |
void |
unSetBits(int bits)
Set a number of bits to 0. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected byte B
Constructor Detail |
---|
public EnhancedByte(byte value)
value
- a value to be assigned to Byte.Method Detail |
---|
public boolean isBitSetAt(int pos)
pos
- the position of the bit within the byte.
0 is the least significant bit, while 7 is the most
significant bit.public static boolean isBitSetAt(byte b, int pos)
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.public boolean areBitsSet(int bits)
bits
- the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.public static boolean areBitsSet(byte b, int bits)
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.public void setBitAt(int pos)
pos
- the position of the bit to be set.
0 is the least significant bit, while 7 is the most
significant bit.public void unSetBitAt(int pos)
pos
- the position of the bit to be set.
0 is the least significant bit, while 7 is the most
significant bit.public static byte setBitAt(byte b, int pos)
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.public static byte unSetBitAt(byte b, int pos)
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.public void setBits(int bits)
bits
- the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.public void unSetBits(int bits)
bits
- the positions of the bits within the byte.
For example, the value 0x4A stands for bits 1, 4, and 6.public static byte setBits(byte b, int bits)
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.public static byte unSetBits(byte b, int bits)
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.public static long getLong(byte[] w)
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.public static long getUnsignedLong(byte[] w)
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.public static int getInteger(byte[] w)
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.public static int getUnsignedInteger(byte[] w)
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.public static int byteToUnsignedInteger(byte b)
b
- the byte to be convertedpublic void inverse()
public static byte inverse(byte b)
b
- the byte to be changedpublic static int inverse(int i)
i
- the integer to be changedpublic static long inverse(long l)
l
- the long integer to be changedpublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |