public final class NumericalUtility extends Object
CATION: This class may not have an optimized runtime behavior!
Modifier and Type | Method and Description |
---|---|
static byte[] |
fromBase64(String aString)
Decodes a string "base 64" and returns the according byte array.
|
static boolean |
isMaskable(int aValue,
int aMask)
Tests if the bits set in the parameter mask are also set in the parameter
value.
|
static boolean |
isTrueAt(int aValue,
int aPos)
Tests whether the bit at position pos is set in the parameter value and
returns true if this is the case.
|
static int |
sum(int... aSummands)
Calculates the sum from the provided summands.
|
static String |
toBase36(byte[] aByteArray)
Encodes a byte array "base 36" and returns the according string.
|
static String |
toBase36(long aLongValue)
Encodes a long value "base 36" and returns the according string.
|
static String |
toBase64(byte[] aByteArray)
Encodes a byte array "base 64" and returns the according string.
|
static String |
toBase64(long aLongValue)
Encodes a long value "base 64" and returns the according string.
|
static int |
toBitwiseAND(int aValueA,
int aValueB)
The result of this method is a contransceiver of the parameters valueA
and valueB.
|
static int |
toBitwiseNOT(int aValue)
The result of this method is the negation of the given value.
|
static int |
toBitwiseOR(int aValueA,
int aValueB)
The result of this method is a distransceiver of the parameters valueA
and valueB.
|
static int |
toBitwiseXOR(int aValueA,
int aValueB)
The result of this method is an exclusive distransceiver of the
parameters valueA and valueB.
|
static boolean |
toBoolean(String aValue)
Converts the given String to a boolean value.
|
static byte[] |
toBytes(Double aDouble)
Converts a double value to an array of bytes, left(?)
|
static byte[] |
toBytes(Long aLong)
Converts a long value to an array of bytes, left byte being the most
significant one (highest order).
|
static double |
toDouble(String aString)
Creates a double between 0 and 1 from a
String ; useful e.g. when
creating a number from a pass-phrase. |
static double[] |
toDoubles(String aString,
int aCount)
Creates an array with double values between 0 and 1 from a
String
; useful e.g. when creating a bunch of numbers from a pass-phrase. |
static int |
toHashCode(Object... aObjects)
Calculates a hash code from the given object's hash codes.
|
static long |
toLong(String aString)
Creates a long from a
String ; useful e.g. when creating a number
from a pass-phrase. |
static String |
toMd5Hash(String aText)
Generates a md5 hash of the given text.
|
static double |
toScaled(double aValue,
double aMin,
double aMax)
Scales the given value (which must be between 0 .. 1 to be between aMin
.. aMax.
|
static long |
toUnsignedLong(int aSignedIntValue)
Converts a signed int to an unsigned long value.
|
public static int toBitwiseAND(int aValueA, int aValueB)
aValueA
- Value A to be used.aValueB
- Value B to be used.public static int toBitwiseNOT(int aValue)
aValue
- Value to be used.public static int toBitwiseOR(int aValueA, int aValueB)
aValueA
- Value A to be used.aValueB
- Value B to be used.public static int toBitwiseXOR(int aValueA, int aValueB)
aValueA
- Value A to be used.aValueB
- Value B to be used.public static boolean isMaskable(int aValue, int aMask)
aValue
- The value to see if the true values in the mask are also
true in the value.aMask
- The mask which's true values are to be verified against the
provided value.public static boolean isTrueAt(int aValue, int aPos)
aValue
- The value interpreted as a bit-field.aPos
- The position of the bit-field to be tested.public static byte[] toBytes(Long aLong)
aLong
- The long value to be convertedpublic static byte[] toBytes(Double aDouble)
aDouble
- The double value to be convertedpublic static String toBase36(long aLongValue)
aLongValue
- The long value to be base 36 encoded.public static String toBase36(byte[] aByteArray)
aByteArray
- The byte array to be base 36 encoded.public static String toBase64(long aLongValue)
aLongValue
- The long value to be base 64 encoded.public static String toBase64(byte[] aByteArray)
aByteArray
- The byte array to be base 64 encoded.public static byte[] fromBase64(String aString)
aString
- The string to be base 64 decoded.public static long toLong(String aString)
String
; useful e.g. when creating a number
from a pass-phrase.public static double toDouble(String aString)
String
; useful e.g. when
creating a number from a pass-phrase.public static double[] toDoubles(String aString, int aCount)
String
; useful e.g. when creating a bunch of numbers from a pass-phrase.public static int toHashCode(Object... aObjects)
aObjects
- The objects for which to calculate the has codes.public static long toUnsignedLong(int aSignedIntValue)
aSignedIntValue
- The signed integer value.public static boolean toBoolean(String aValue) throws IllegalArgumentException
aValue
- The text value to be tested whether it represents true or
false.IllegalArgumentException
- in case neither true nor false could be
determined.public static String toMd5Hash(String aText)
aText
- The text to be md5 hashed.public static double toScaled(double aValue, double aMin, double aMax)
aValue
- The value between 0 .. 1 to be scaled.aMin
- The min value.aMax
- The max value.public static int sum(int... aSummands)
aSummands
- The summands to be added up.Copyright © 2015. All rights reserved.