Java Reference
In-Depth Information
Note that none of the string formats include information regarding the
radix in that formatthere is no leading 0 for octal, or 0x for hexadecimal.
If radix information is needed then you must construct it yourself.
The Short , Integer , and Long classes have a method reverseBytes that re-
turns a value with its constituent bytes in the reverse order to the value
passed in. For example, Integer.reverseBytes(0x0000ABCD) returns an int
value with the hexadecimal representation of 0xCDAB0000 . The Integer and
Long classes also provide a family of bit-querying methods:
public static int bitCount( type val)
Returns the number of one-bits in the two's complement bin-
ary representations of val .
public static type highestOneBit( type val)
Returns a value consisting of all zero-bits, except for a single
one-bit, in the same position as the highest-order (left-most)
one-bit in val .
public static type lowestOneBit( type val)
Returns a value consisting of all zero-bits, except for a single
one-bit, in the same position as the lowest-order (right-most)
one-bit in val .
public static int numberOfLeadingZeros( type val)
Returns the number of zero-bits preceding the highest-order
one-bit in val .
public static int numberOfTrailingZeros( type val)
Returns the number of zero-bits following the lowest-order
one-bit in val .
 
Search WWH ::




Custom Search