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 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 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 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 © 2016. All rights reserved.