Package sun.misc
Class FloatingDecimal
- java.lang.Object
-
- sun.misc.FloatingDecimal
-
public class FloatingDecimal extends Object
A class for converting between ASCII and decimal representations of a single or double precision floating point number. Most conversions are provided via static convenience methods, although aBinaryToASCIIConverterinstance may be obtained and reused.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFloatingDecimal.BinaryToASCIIConverterA converter which can process single or double precision floating point values into an ASCIIStringrepresentation.
-
Constructor Summary
Constructors Constructor Description FloatingDecimal()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intnumberOfLeadingZeros(long i)Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specifiedlongvalue.static intnumberOfTrailingZeros(long i)Returns the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of the specifiedlongvalue.
-
-
-
Method Detail
-
numberOfLeadingZeros
public static int numberOfLeadingZeros(long i)
Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specifiedlongvalue. Returns 64 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.Note that this method is closely related to the logarithm base 2. For all positive
longvalues x:- floor(log2(x)) =
63 - numberOfLeadingZeros(x) - ceil(log2(x)) =
64 - numberOfLeadingZeros(x - 1)
- Parameters:
i- the value whose number of leading zeros is to be computed- Returns:
- the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary
representation of the specified
longvalue, or 64 if the value is equal to zero. - Since:
- 1.5
- floor(log2(x)) =
-
numberOfTrailingZeros
public static int numberOfTrailingZeros(long i)
Returns the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of the specifiedlongvalue. Returns 64 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.- Parameters:
i- the value whose number of trailing zeros is to be computed- Returns:
- the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary
representation of the specified
longvalue, or 64 if the value is equal to zero. - Since:
- 1.5
-
-