public final class NumbersUtils extends Object
Modifier and Type | Field and Description |
---|---|
static double |
DOUBLE_MIN_NORMAL
Double.MIN_NORMAL since Java 6.
|
static float |
FLOAT_MIN_NORMAL
Float.MIN_NORMAL since Java 6.
|
Modifier and Type | Method and Description |
---|---|
static int |
abs(int a)
Possibly faster than java.lang.Math.abs(int).
|
static long |
abs(long a)
Possibly faster than java.lang.Math.abs(long).
|
static int |
absNeg(int a) |
static long |
absNeg(long a) |
static byte |
asByte(int a)
Not defining an asByte(long) method, since asByte((int)aLong) works.
|
static int |
asInt(long a) |
static int |
bitSizeForSignedValue(int value) |
static int |
bitSizeForSignedValue(long value) |
static int |
bitSizeForUnsignedValue(int value) |
static int |
bitSizeForUnsignedValue(long value) |
static short |
byteAsUnsigned(byte value) |
static int |
ceilingPowerOfTwo(int a) |
static long |
ceilingPowerOfTwo(long a) |
static boolean |
checkBitPositionsByte(int firstBitPos,
int lastBitPosExcl) |
static boolean |
checkBitPositionsInt(int firstBitPos,
int lastBitPosExcl) |
static boolean |
checkBitPositionsLong(int firstBitPos,
int lastBitPosExcl) |
static boolean |
checkBitPositionsShort(int firstBitPos,
int lastBitPosExcl) |
static boolean |
checkBitSizeForSignedInt(int bitSize) |
static boolean |
checkBitSizeForSignedLong(int bitSize) |
static boolean |
checkBitSizeForUnsignedInt(int bitSize) |
static boolean |
checkBitSizeForUnsignedLong(int bitSize) |
static boolean |
checkIsInRange(double min,
double max,
double a) |
static boolean |
checkIsInRange(float min,
float max,
float a) |
static boolean |
checkIsInRange(int min,
int max,
int a) |
static boolean |
checkIsInRange(long min,
long max,
long a) |
static boolean |
checkIsInRangeSigned(int a,
int bitSize) |
static boolean |
checkIsInRangeSigned(long a,
int bitSize) |
static boolean |
checkIsInRangeUnsigned(int a,
int bitSize) |
static boolean |
checkIsInRangeUnsigned(long a,
int bitSize) |
static boolean |
checkRadix(int radix) |
static int |
computeNbrOfChars(int value,
int radix) |
static int |
computeNbrOfChars(int value,
int radix,
int paddingUpTo) |
static int |
computeNbrOfChars(long value,
int radix) |
static int |
computeNbrOfChars(long value,
int radix,
int paddingUpTo) |
static int |
computeNbrOfDigits(int value,
int radix) |
static int |
computeNbrOfDigits(int value,
int radix,
int paddingUpTo) |
static int |
computeNbrOfDigits(long value,
int radix) |
static int |
computeNbrOfDigits(long value,
int radix,
int paddingUpTo) |
static boolean |
equal(double a,
double b) |
static boolean |
equal(float a,
float b) |
static int |
floorPowerOfTwo(int a) |
static long |
floorPowerOfTwo(long a) |
static boolean |
haveSameEvenness(int a,
int b) |
static boolean |
haveSameEvenness(long a,
long b) |
static boolean |
haveSameSign(int a,
int b) |
static boolean |
haveSameSign(long a,
long b) |
static long |
intAsUnsigned(int value) |
static int |
intHash(long a)
If the specified value is in int range, the returned value is identical.
|
static int |
intMaskLSBits0(int bitSize) |
static int |
intMaskLSBits1(int bitSize) |
static int |
intMaskMSBits0(int bitSize) |
static int |
intMaskMSBits1(int bitSize) |
static boolean |
isEquidistant(double value) |
static boolean |
isEquidistant(float value) |
static boolean |
isEven(int a) |
static boolean |
isEven(long a) |
static boolean |
isInRange(double min,
double max,
double a)
Returns false if any value is NaN.
|
static boolean |
isInRange(float min,
float max,
float a)
Returns false if any value is NaN.
|
static boolean |
isInRange(int min,
int max,
int a) |
static boolean |
isInRange(long min,
long max,
long a) |
static boolean |
isInRangeSigned(int a,
int bitSize) |
static boolean |
isInRangeSigned(long a,
int bitSize) |
static boolean |
isInRangeUnsigned(int a,
int bitSize) |
static boolean |
isInRangeUnsigned(long a,
int bitSize) |
static boolean |
isMathematicalInteger(double value) |
static boolean |
isMathematicalInteger(float value) |
static boolean |
isNaNOrInfinite(double a) |
static boolean |
isNaNOrInfinite(float a) |
static boolean |
isOdd(int a) |
static boolean |
isOdd(long a) |
static boolean |
isPowerOfTwo(int a) |
static boolean |
isPowerOfTwo(long a) |
static boolean |
isSignedPowerOfTwo(int a) |
static boolean |
isSignedPowerOfTwo(long a) |
static boolean |
isValidBitSizeForSignedInt(int bitSize) |
static boolean |
isValidBitSizeForSignedLong(int bitSize) |
static boolean |
isValidBitSizeForUnsignedInt(int bitSize) |
static boolean |
isValidBitSizeForUnsignedLong(int bitSize) |
static int |
log2(int value) |
static int |
log2(long value) |
static long |
longMaskLSBits0(int bitSize) |
static long |
longMaskLSBits1(int bitSize) |
static long |
longMaskMSBits0(int bitSize) |
static long |
longMaskMSBits1(int bitSize) |
static int |
maxSignedIntForBitSize(int bitSize) |
static long |
maxSignedLongForBitSize(int bitSize) |
static int |
maxUnsignedIntForBitSize(int bitSize) |
static long |
maxUnsignedLongForBitSize(int bitSize) |
static int |
meanLow(int a,
int b) |
static long |
meanLow(long a,
long b) |
static int |
meanSml(int a,
int b) |
static long |
meanSml(long a,
long b) |
static int |
minSignedIntForBitSize(int bitSize) |
static long |
minSignedLongForBitSize(int bitSize) |
static double |
minus2PI_strict(double angRad)
Strict version.
|
static double |
minus2PI(double angRad) |
static int |
minusBounded(int a,
int b) |
static long |
minusBounded(long a,
long b) |
static int |
minusExact(int a,
int b) |
static long |
minusExact(long a,
long b) |
static double |
minusPI_strict(double angRad)
Strict version.
|
static double |
minusPI(double angRad) |
static double |
minusPIO2_strict(double angRad)
Strict version.
|
static double |
minusPIO2(double angRad) |
static int |
moduloSignedPowerOfTwo(int value,
int spot)
This treatment being designed for optimization, the fact that spot
is a signed power of two is not checked.
|
static long |
moduloSignedPowerOfTwo(long value,
long spot)
This treatment being designed for optimization, the fact that spot
is a signed power of two is not checked.
|
static int |
negHalfWidth(int min,
int max)
Useful because a positive int value could not represent half the width
of full int range width, which is mathematically Integer.MAX_VALUE+1.
|
static long |
negHalfWidth(long min,
long max)
Useful because a positive long value could not represent half the width
of full long range width, which is mathematically Long.MAX_VALUE+1.
|
static double |
plus2PI_strict(double angRad)
Strict version.
|
static double |
plus2PI(double angRad) |
static int |
plusBounded(int a,
int b) |
static long |
plusBounded(long a,
long b) |
static int |
plusExact(int a,
int b) |
static long |
plusExact(long a,
long b) |
static double |
plusPI_strict(double angRad)
Strict version.
|
static double |
plusPI(double angRad) |
static double |
plusPIO2_strict(double angRad)
Strict version.
|
static double |
plusPIO2(double angRad) |
static double |
pow2_strict(double a)
Strict version.
|
static float |
pow2_strict(float a)
Strict version.
|
static double |
pow2(double a) |
static float |
pow2(float a) |
static int |
pow2(int a) |
static long |
pow2(long a) |
static double |
pow3_strict(double a)
Strict version.
|
static float |
pow3_strict(float a)
Strict version.
|
static double |
pow3(double a) |
static float |
pow3(float a) |
static int |
pow3(int a) |
static long |
pow3(long a) |
static int |
shortAsUnsigned(short value) |
static long |
signFromBit(double value) |
static int |
signFromBit(float value) |
static int |
signum(int a) |
static int |
signum(long a) |
static int |
timesBounded(int a,
int b) |
static long |
timesBounded(long a,
long b) |
static int |
timesExact(int a,
int b) |
static long |
timesExact(long a,
long b) |
static int |
toInt(long a) |
static double |
toRange(double min,
double max,
double a) |
static float |
toRange(float min,
float max,
float a) |
static int |
toRange(int min,
int max,
int a) |
static long |
toRange(long min,
long max,
long a) |
static String |
toString(int value)
This method just delegates to Integer.toString(int),
but is defined here to complete the API.
|
static String |
toString(int value,
int radix) |
static String |
toString(int value,
int radix,
int paddingUpTo) |
static String |
toString(long value)
This method just delegates to Long.toString(long),
but is defined here to complete the API.
|
static String |
toString(long value,
int radix) |
static String |
toString(long value,
int radix,
int paddingUpTo) |
static String |
toStringBits(byte bits) |
static String |
toStringBits(byte bits,
int firstBitPos,
int lastBitPosExcl,
boolean bigEndian,
boolean padding) |
static String |
toStringBits(int bits) |
static String |
toStringBits(int bits,
int firstBitPos,
int lastBitPosExcl,
boolean bigEndian,
boolean padding) |
static String |
toStringBits(long bits) |
static String |
toStringBits(long bits,
int firstBitPos,
int lastBitPosExcl,
boolean bigEndian,
boolean padding) |
static String |
toStringBits(short bits) |
static String |
toStringBits(short bits,
int firstBitPos,
int lastBitPosExcl,
boolean bigEndian,
boolean padding) |
static String |
toStringCSN(double value) |
static String |
toStringNoCSN(double value) |
static double |
twoPow(int power)
Returns the exact result, provided it's in double range,
i.e.
|
static int |
twoPowAsIntBounded(int power) |
static int |
twoPowAsIntExact(int power) |
static long |
twoPowAsLongBounded(int power) |
static long |
twoPowAsLongExact(int power) |
public static final double DOUBLE_MIN_NORMAL
public static final float FLOAT_MIN_NORMAL
public static boolean equal(float a, float b)
public static boolean equal(double a, double b)
public static boolean isMathematicalInteger(float value)
public static boolean isMathematicalInteger(double value)
public static boolean isEquidistant(float value)
value
- A float value.public static boolean isEquidistant(double value)
value
- A double value.public static boolean isNaNOrInfinite(float a)
value
- A float value.public static boolean isNaNOrInfinite(double a)
value
- A double value.public static int signFromBit(float value)
value
- A float value.public static long signFromBit(double value)
value
- A double value.public static boolean isInRange(int min, int max, int a)
public static boolean isInRange(long min, long max, long a)
public static boolean isInRange(float min, float max, float a)
public static boolean isInRange(double min, double max, double a)
public static boolean checkIsInRange(int min, int max, int a)
IllegalArgumentException
- if the specified value is not in the specified range (inclusive).public static boolean checkIsInRange(long min, long max, long a)
IllegalArgumentException
- if the specified value is not in the specified range (inclusive).public static boolean checkIsInRange(float min, float max, float a)
IllegalArgumentException
- if the specified value is not in the specified range (inclusive)
or any parameter is NaN.public static boolean checkIsInRange(double min, double max, double a)
IllegalArgumentException
- if the specified value is not in the specified range (inclusive)
or any parameter is NaN.public static int toRange(int min, int max, int a)
min
- A value.max
- A value.a
- A value.public static long toRange(long min, long max, long a)
min
- A value.max
- A value.a
- A value.public static float toRange(float min, float max, float a)
min
- A value.max
- A value.a
- A value.public static double toRange(double min, double max, double a)
min
- A value.max
- A value.a
- A value.public static boolean isInRangeSigned(int a, int bitSize)
bitSize
- A number of bits, in [1,32].IllegalArgumentException
- if the specified number of bits is not in [1,32].public static boolean isInRangeSigned(long a, int bitSize)
bitSize
- A number of bits, in [1,64].IllegalArgumentException
- if the specified number of bits is not in [1,64].public static boolean isInRangeUnsigned(int a, int bitSize)
bitSize
- A number of bits, in [1,31].IllegalArgumentException
- if the specified number of bits is not in [1,31].public static boolean isInRangeUnsigned(long a, int bitSize)
bitSize
- A number of bits, in [1,63].IllegalArgumentException
- if the specified number of bits is not in [1,63].public static boolean checkIsInRangeSigned(int a, int bitSize)
bitSize
- A number of bits, in [1,32].IllegalArgumentException
- if the specified value does not fit
as a signed integer over the specified number of bits.public static boolean checkIsInRangeSigned(long a, int bitSize)
bitSize
- A number of bits, in [1,64].IllegalArgumentException
- if the specified value does not fit
as a signed integer over the specified number of bits.public static boolean checkIsInRangeUnsigned(int a, int bitSize)
bitSize
- A number of bits, in [1,31].IllegalArgumentException
- if the specified value does not fit
as an unsigned integer over the specified number of bits.public static boolean checkIsInRangeUnsigned(long a, int bitSize)
bitSize
- A number of bits, in [1,63].IllegalArgumentException
- if the specified value does not fit
as an unsigned integer over the specified number of bits.public static int intMaskMSBits0(int bitSize)
bitSize
- A number of bits, in [0,32].public static int intMaskMSBits1(int bitSize)
bitSize
- A number of bits, in [0,32].public static int intMaskLSBits0(int bitSize)
bitSize
- A number of bits, in [0,32].public static int intMaskLSBits1(int bitSize)
bitSize
- A number of bits, in [0,32].public static long longMaskMSBits0(int bitSize)
bitSize
- A number of bits, in [0,64].public static long longMaskMSBits1(int bitSize)
bitSize
- A number of bits, in [0,64].public static long longMaskLSBits0(int bitSize)
bitSize
- A number of bits, in [0,64].public static long longMaskLSBits1(int bitSize)
bitSize
- A number of bits, in [0,64].public static short byteAsUnsigned(byte value)
public static int shortAsUnsigned(short value)
public static long intAsUnsigned(int value)
public static boolean isValidBitSizeForSignedInt(int bitSize)
public static boolean isValidBitSizeForSignedLong(int bitSize)
public static boolean isValidBitSizeForUnsignedInt(int bitSize)
public static boolean isValidBitSizeForUnsignedLong(int bitSize)
public static boolean checkBitSizeForSignedInt(int bitSize)
IllegalArgumentException
- if a signed int value can't be read over the
specified number of bits, i.e. if it is not in [1,32].public static boolean checkBitSizeForSignedLong(int bitSize)
IllegalArgumentException
- if a signed long value can't be read over the
specified number of bits, i.e. if it is not in [1,64].public static boolean checkBitSizeForUnsignedInt(int bitSize)
IllegalArgumentException
- if an unsigned int value can't be read over the
specified number of bits, i.e. if it is not in [1,31].public static boolean checkBitSizeForUnsignedLong(int bitSize)
IllegalArgumentException
- if an unsigned long value can't be read over the
specified number of bits, i.e. if it is not in [1,63].public static int minSignedIntForBitSize(int bitSize)
bitSize
- A number of bits in [1,32].IllegalArgumentException
- if the specified number of bits is out of range.public static long minSignedLongForBitSize(int bitSize)
bitSize
- A number of bits in [1,64].IllegalArgumentException
- if the specified number of bits is out of range.public static int maxSignedIntForBitSize(int bitSize)
bitSize
- A number of bits in [1,32].IllegalArgumentException
- if the specified number of bits is out of range.public static long maxSignedLongForBitSize(int bitSize)
bitSize
- A number of bits in [1,64].IllegalArgumentException
- if the specified number of bits is out of range.public static int maxUnsignedIntForBitSize(int bitSize)
bitSize
- A number of bits in [1,31].IllegalArgumentException
- if the specified number of bits is out of range.public static long maxUnsignedLongForBitSize(int bitSize)
bitSize
- A number of bits in [1,63].IllegalArgumentException
- if the specified number of bits is out of range.public static int bitSizeForSignedValue(int value)
public static int bitSizeForSignedValue(long value)
public static int bitSizeForUnsignedValue(int value)
value
- An integer value in [0,Integer.MAX_VALUE].IllegalArgumentException
- if the specified value is < 0.public static int bitSizeForUnsignedValue(long value)
value
- An integer value in [0,Long.MAX_VALUE].IllegalArgumentException
- if the specified value is < 0.public static int signum(int a)
public static int signum(long a)
public static boolean isEven(int a)
public static boolean isEven(long a)
public static boolean isOdd(int a)
public static boolean isOdd(long a)
public static boolean haveSameEvenness(int a, int b)
public static boolean haveSameEvenness(long a, long b)
public static boolean haveSameSign(int a, int b)
public static boolean haveSameSign(long a, long b)
public static boolean isPowerOfTwo(int a)
public static boolean isPowerOfTwo(long a)
public static boolean isSignedPowerOfTwo(int a)
public static boolean isSignedPowerOfTwo(long a)
public static int floorPowerOfTwo(int a)
a
- A value in [1,Integer.MAX_VALUE].public static long floorPowerOfTwo(long a)
a
- A value in [1,Long.MAX_VALUE].public static int ceilingPowerOfTwo(int a)
a
- A value in [0,2^30].public static long ceilingPowerOfTwo(long a)
a
- A value in [0,2^62].public static int meanLow(int a, int b)
public static long meanLow(long a, long b)
public static int meanSml(int a, int b)
public static long meanSml(long a, long b)
public static int negHalfWidth(int min, int max)
IllegalArgumentException
- if min > max.public static long negHalfWidth(long min, long max)
IllegalArgumentException
- if min > max.public static int moduloSignedPowerOfTwo(int value, int spot)
value
- A value.spot
- A signed power of two (i.e. a value of the form +-2^k, k >= 0).public static long moduloSignedPowerOfTwo(long value, long spot)
value
- A value.spot
- A signed power of two (i.e. a value of the form +-2^k, k >= 0).public static int log2(int value)
value
- An integer value > 0.IllegalArgumentException
- if the specified value is <= 0.public static int log2(long value)
value
- An integer value > 0.IllegalArgumentException
- if the specified value is <= 0.public static int abs(int a)
public static long abs(long a)
public static int absNeg(int a)
public static long absNeg(long a)
public static int intHash(long a)
public static byte asByte(int a)
a
- An int value.ArithmeticException
- if the specified value is not in [Byte.MIN_VALUE,Byte.MAX_VALUE] range.public static int asInt(long a)
a
- A long value.ArithmeticException
- if the specified value is not in [Integer.MIN_VALUE,Integer.MAX_VALUE] range.public static int toInt(long a)
a
- A long value.public static int plusExact(int a, int b)
a
- An int value.b
- An int value.ArithmeticException
- if the mathematical result of a+b is not in [Integer.MIN_VALUE,Integer.MAX_VALUE] range.public static long plusExact(long a, long b)
a
- A long value.b
- A long value.ArithmeticException
- if the mathematical result of a+b is not in [Long.MIN_VALUE,Long.MAX_VALUE] range.public static int plusBounded(int a, int b)
a
- An int value.b
- An int value.public static long plusBounded(long a, long b)
a
- A long value.b
- A long value.public static int minusExact(int a, int b)
a
- An int value.b
- An int value.ArithmeticException
- if the mathematical result of a-b is not in [Integer.MIN_VALUE,Integer.MAX_VALUE] range.public static long minusExact(long a, long b)
a
- A long value.b
- A long value.ArithmeticException
- if the mathematical result of a-b is not in [Long.MIN_VALUE,Long.MAX_VALUE] range.public static int minusBounded(int a, int b)
a
- An int value.b
- An int value.public static long minusBounded(long a, long b)
a
- A long value.b
- A long value.public static int timesExact(int a, int b)
a
- An int value.b
- An int value.ArithmeticException
- if the mathematical result of a*b is not in [Integer.MIN_VALUE,Integer.MAX_VALUE] range.public static long timesExact(long a, long b)
a
- A long value.b
- A long value.ArithmeticException
- if the mathematical result of a*b is not in [Long.MIN_VALUE,Long.MAX_VALUE] range.public static int timesBounded(int a, int b)
a
- An int value.b
- An int value.public static long timesBounded(long a, long b)
a
- A long value.b
- A long value.public static double twoPow(int power)
power
- An int power.public static int twoPowAsIntExact(int power)
power
- An int power.ArithmeticException
- if the mathematical result
is not in int range, i.e. if power is not in [0,30].public static int twoPowAsIntBounded(int power)
power
- An int power.public static long twoPowAsLongExact(int power)
power
- An int power.ArithmeticException
- if the mathematical result
is not in long range, i.e. if power is not in [0,62].public static long twoPowAsLongBounded(int power)
power
- An int power.public static int pow2(int a)
a
- A value.public static long pow2(long a)
a
- A value.public static float pow2(float a)
a
- A value.public static float pow2_strict(float a)
a
- A value.public static double pow2(double a)
a
- A value.public static double pow2_strict(double a)
a
- A value.public static int pow3(int a)
a
- A value.public static long pow3(long a)
a
- A value.public static float pow3(float a)
a
- A value.public static float pow3_strict(float a)
a
- A value.public static double pow3(double a)
a
- A value.public static double pow3_strict(double a)
a
- A value.public static double plus2PI(double angRad)
angRad
- An angle, in radians.public static double plus2PI_strict(double angRad)
angRad
- An angle, in radians.public static double minus2PI(double angRad)
angRad
- An angle, in radians.public static double minus2PI_strict(double angRad)
angRad
- An angle, in radians.public static double plusPI(double angRad)
angRad
- An angle, in radians.public static double plusPI_strict(double angRad)
angRad
- An angle, in radians.public static double minusPI(double angRad)
angRad
- An angle, in radians.public static double minusPI_strict(double angRad)
angRad
- An angle, in radians.public static double plusPIO2(double angRad)
angRad
- An angle, in radians.public static double plusPIO2_strict(double angRad)
angRad
- An angle, in radians.public static double minusPIO2(double angRad)
angRad
- An angle, in radians.public static double minusPIO2_strict(double angRad)
angRad
- An angle, in radians.public static boolean checkRadix(int radix)
radix
- Radix to be checked.IllegalArgumentException
- if the specified radix is not in [2,36].public static int computeNbrOfChars(int value, int radix)
radix
- A radix in [2,36].public static int computeNbrOfChars(long value, int radix)
radix
- A radix in [2,36].public static int computeNbrOfChars(int value, int radix, int paddingUpTo)
radix
- A radix in [2,36].paddingUpTo
- Number of digits (sign excluded) up to which left-padding with zeros is done.public static int computeNbrOfChars(long value, int radix, int paddingUpTo)
radix
- A radix in [2,36].paddingUpTo
- Number of digits (sign excluded) up to which left-padding with zeros is done.public static int computeNbrOfDigits(int value, int radix)
radix
- A radix in [2,36].public static int computeNbrOfDigits(long value, int radix)
radix
- A radix in [2,36].public static int computeNbrOfDigits(int value, int radix, int paddingUpTo)
radix
- A radix in [2,36].paddingUpTo
- Number of digits (sign excluded) up to which left-padding with zeros is done.public static int computeNbrOfDigits(long value, int radix, int paddingUpTo)
radix
- A radix in [2,36].paddingUpTo
- Number of digits (sign excluded) up to which left-padding with zeros is done.public static String toString(int value)
public static String toString(long value)
public static String toString(int value, int radix)
radix
- A radix in [2,36].IllegalArgumentException
- if the specified radix is out of range.public static String toString(long value, int radix)
radix
- A radix in [2,36].IllegalArgumentException
- if the specified radix is out of range.public static String toString(int value, int radix, int paddingUpTo)
radix
- A radix in [2,36].paddingUpTo
- Number of digits (sign excluded) up to which left-padding with zeros is done.IllegalArgumentException
- if the specified radix is out of range.public static String toString(long value, int radix, int paddingUpTo)
radix
- A radix in [2,36].paddingUpTo
- Number of digits (sign excluded) up to which left-padding with zeros is done.IllegalArgumentException
- if the specified radix is out of range.public static boolean checkBitPositionsByte(int firstBitPos, int lastBitPosExcl)
firstBitPos
- First bit position (inclusive).lastBitPosExcl
- Last bit position (exclusive).IllegalArgumentException
- if the specified bit range does not fit in a byte.public static boolean checkBitPositionsShort(int firstBitPos, int lastBitPosExcl)
firstBitPos
- First bit position (inclusive).lastBitPosExcl
- Last bit position (exclusive).IllegalArgumentException
- if the specified bit range does not fit in a short.public static boolean checkBitPositionsInt(int firstBitPos, int lastBitPosExcl)
firstBitPos
- First bit position (inclusive).lastBitPosExcl
- Last bit position (exclusive).IllegalArgumentException
- if the specified bit range does not fit in an int.public static boolean checkBitPositionsLong(int firstBitPos, int lastBitPosExcl)
firstBitPos
- First bit position (inclusive).lastBitPosExcl
- Last bit position (exclusive).IllegalArgumentException
- if the specified bit range does not fit in a long.public static String toStringBits(byte bits)
public static String toStringBits(short bits)
public static String toStringBits(int bits)
public static String toStringBits(long bits)
public static String toStringBits(byte bits, int firstBitPos, int lastBitPosExcl, boolean bigEndian, boolean padding)
firstBitPos
- First bit position (inclusive).lastBitPosExcl
- Last bit position (exclusive).bigEndian
- True for bits to be added in big endian order (MSBit to LSBit)
false for little endian order.padding
- True if underscores must be added instead of out-of-range bits,
false to just add characters corresponding to in-range bits.public static String toStringBits(short bits, int firstBitPos, int lastBitPosExcl, boolean bigEndian, boolean padding)
firstBitPos
- First bit position (inclusive).lastBitPosExcl
- Last bit position (exclusive).bigEndian
- True for bits to be added in big endian order (MSBit to LSBit)
false for little endian order.padding
- True if underscores must be added instead of out-of-range bits,
false to just add characters corresponding to in-range bits.public static String toStringBits(int bits, int firstBitPos, int lastBitPosExcl, boolean bigEndian, boolean padding)
firstBitPos
- First bit position (inclusive).lastBitPosExcl
- Last bit position (exclusive).bigEndian
- True for bits to be added in big endian order (MSBit to LSBit)
false for little endian order.padding
- True if underscores must be added instead of out-of-range bits,
false to just add characters corresponding to in-range bits.public static String toStringBits(long bits, int firstBitPos, int lastBitPosExcl, boolean bigEndian, boolean padding)
firstBitPos
- First bit position (inclusive).lastBitPosExcl
- Last bit position (exclusive).bigEndian
- True for bits to be added in big endian order (MSBit to LSBit)
false for little endian order.padding
- True if underscores must be added instead of out-of-range bits,
false to just add characters corresponding to in-range bits.public static String toStringCSN(double value)
value
- A double value.public static String toStringNoCSN(double value)
value
- A double value.Jas4pp 1.5 © Java Analysis Studio for Particle Physics