Class RulesUtils
- java.lang.Object
-
- org.openl.rules.helpers.RulesUtils
-
public final class RulesUtils extends Object
This class is connected to rules and all these methods can be used from rules.- Author:
- snshor
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DOUBLE_FORMATstatic doubleEstatic doublePI
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static doubleabs(double a)Returns the absolute value of adoublevalue.static floatabs(float a)Returns the absolute value of afloatvalue.static intabs(int a)Returns the absolute value of anintvalue.static longabs(long a)Returns the absolute value of alongvalue.static IntegerabsMonth(Date d)static IntegerabsQuarter(Date d)static doubleacos(double a)Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi.static Objectadd(Object... arrays)static ObjectaddAll(Object... arrays)Adds all the elements of the given arrays into a new array.static Object[]addArrayElementIgnoreNull(Object[] array, int index, Object element)Deprecated.static Object[]addArrayElementIgnoreNull(Object[] array, Object element)Deprecated.static <T> T[]addIgnoreNull(T[] array, int index, T element)Deprecated.static <T> T[]addIgnoreNull(T[] array, T element)Deprecated.static StringamPm(Date d)Returns AM or PMstatic doubleasin(double a)Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2.static doubleatan(double a)Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2.static doubleatan2(double y, double x)Returns the angle theta from the conversion of rectangular coordinates (x,y) to polar coordinates (r, theta).static Bytebig(byte[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Doublebig(double[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Floatbig(float[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Integerbig(int[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Longbig(long[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Shortbig(short[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Bytebig(Byte[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Doublebig(Double[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Floatbig(Float[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Integerbig(Integer[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Longbig(Long[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static Shortbig(Short[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static BigDecimalbig(BigDecimal[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static BigIntegerbig(BigInteger[] values, int position)Removes null values from array, sorts an array in descending order and returns the value at position 'position'static doublecbrt(double a)Returns the cube root of adoublevalue.static doubleceil(double a)Returns the smallest (closest to negative infinity)doublevalue that is greater than or equal to the argument and is equal to a mathematical integer.static booleancontains(boolean[] array, boolean elem)static booleancontains(boolean[] ary1, boolean[] ary2)static booleancontains(byte[] array, byte elem)Checks if the value is in the given array.static booleancontains(byte[] ary1, byte[] ary2)static booleancontains(char[] array, char elem)Checks if the value is in the given array.static booleancontains(char[] ary1, char[] ary2)static booleancontains(double[] array, double elem)Checks if the value is in the given array.static booleancontains(double[] ary1, double[] ary2)static booleancontains(float[] array, float elem)Checks if the value is in the given array.static booleancontains(float[] ary1, float[] ary2)static booleancontains(int[] array, int elem)Checks if the value is in the given array.static booleancontains(int[] ary1, int[] ary2)static booleancontains(long[] array, long elem)Checks if the value is in the given array.static booleancontains(long[] ary1, long[] ary2)static booleancontains(short[] array, short elem)Checks if the value is in the given array.static booleancontains(short[] ary1, short[] ary2)static booleancontains(Boolean[] array, Boolean elem)static booleancontains(Boolean[] ary1, Boolean[] ary2)static booleancontains(Byte[] array, Byte elem)static booleancontains(Byte[] ary1, Byte[] ary2)static booleancontains(Character[] array, Character elem)static booleancontains(Character[] ary1, Character[] ary2)static booleancontains(Double[] array, Double elem)static booleancontains(Double[] ary1, Double[] ary2)static booleancontains(Float[] array, Float elem)static booleancontains(Float[] ary1, Float[] ary2)static booleancontains(Integer[] array, Integer elem)static booleancontains(Integer[] ary1, Integer[] ary2)static booleancontains(Long[] array, Long elem)static booleancontains(Long[] ary1, Long[] ary2)static booleancontains(Object[] ary1, Object[] ary2)static booleancontains(Short[] array, Short elem)static booleancontains(Short[] ary1, Short[] ary2)static booleancontains(String[] array, String elem)static booleancontains(String[] ary1, String[] ary2)static booleancontains(Date[] array, Date elem)static booleancontains(CharRange[] ary1, char[] ary2)static booleancontains(CharRange[] array, Character elem)static booleancontains(CharRange[] ary1, Character[] ary2)static booleancontains(CharRange range, Character x)static booleancontains(DateRange[] array, Date elem)static booleancontains(DateRange[] ary1, Date[] ary2)static booleancontains(DateRange range, Date x)static booleancontains(DoubleRange[] ary1, double[] ary2)static booleancontains(DoubleRange[] array, Double elem)static booleancontains(DoubleRange[] ary1, Double[] ary2)static booleancontains(DoubleRange range, Double x)static booleancontains(DoubleRange range, BigDecimal x)static booleancontains(IntRange[] ary1, int[] ary2)static booleancontains(IntRange[] array, Integer elem)static booleancontains(IntRange[] ary1, Integer[] ary2)static booleancontains(IntRange range, Long x)static booleancontains(IntRange range, BigInteger x)static booleancontains(StringRange[] array, CharSequence elem)static booleancontains(StringRange[] ary1, CharSequence[] ary2)static booleancontains(StringRange[] array, String elem)static booleancontains(StringRange[] ary1, String[] ary2)static booleancontains(StringRange range, String x)static <T> booleancontains(T[] array, T obj)Checks if the object is in the given array.static <T> Tcopy(T origin)static doublecopySign(double magnitude, double sign)Returns the first floating-point argument with the sign of the second floating-point argument.static floatcopySign(float magnitude, float sign)Returns the first floating-point argument with the sign of the second floating-point argument.static doublecos(double a)Returns the trigonometric cosine of an angle.static doublecosh(double x)Returns the hyperbolic cosine of adoublevalue.static StringdateToString(Date date)Deprecated.static StringdateToString(Date date, String dateFormat)Deprecated.static IntegerdayDiff(Date d1, Date d2)static IntegerdayOfMonth(Date d)static IntegerdayOfWeek(Date d)static IntegerdayOfYear(Date d)static VOIDerror(Object object)static VOIDerror(String msg)static VOIDerror(String code, String message)static doubleexp(double a)Returns Euler's number e raised to the power of adoublevalue.static doubleexpm1(double x)Returns ex -1.static DatefirstDateOfQuarter(int absQuarter)static Object[]flatten(Object... data)static doublefloor(double a)Returns the largest (closest to positive infinity)doublevalue that is less than or equal to the argument and is equal to a mathematical integer.static Stringformat(double d)static Stringformat(double d, String fmt)static Stringformat(Date date)Deprecated.static Stringformat(Date date, String format)Deprecated.static intgetExponent(double d)Returns the unbiased exponent used in the representation of adouble.static doublegetExponent(double x, double y)Returns sqrt(x2 +y2) without intermediate overflow or underflow.static intgetExponent(float f)Returns the unbiased exponent used in the representation of afloat.static ObjectgetValues(StaticDomainOpenClass staticDomainOpenClass)static Integerhour(Date d)static IntegerhourOfDay(Date d)static doubleIEEEremainder(double f1, double f2)Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.static intindexOf(boolean[] array, boolean elem)static intindexOf(byte[] array, byte elem)Finds the index of the given value in the array.static intindexOf(char[] array, char elem)Finds the index of the given value in the array.static intindexOf(double[] array, double elem)Finds the index of the given value in the array.static intindexOf(float[] array, float elem)Finds the index of the given value in the array.static intindexOf(int[] array, int elem)Finds the index of the given value in the array.static intindexOf(long[] array, long elem)Finds the index of the given value in the array.static intindexOf(short[] array, short elem)Finds the index of the given value in the array.static intindexOf(Boolean[] array, Boolean elem)static intindexOf(Byte[] array, Byte elem)static intindexOf(Character[] array, Character elem)static intindexOf(Double[] array, Double elem)static intindexOf(Float[] array, Float elem)static intindexOf(Integer[] array, Integer elem)static intindexOf(Long[] array, Long elem)static intindexOf(Object[] array, Object obj)Finds the index of the given object in the array.static intindexOf(Short[] array, Short elem)static booleaninstanceOf(Object o, Class<?> clazz)static String[]intersection(String[] ary1, String[] ary2)static DatelastDateOfQuarter(int absQuarter)static IntegerlastDayOfMonth(Date d)static doublelog(double a)Returns the natural logarithm (base e) of adoublevalue.static doublelog10(double a)Returns the base 10 logarithm of adoublevalue.static doublelog1p(double x)Returns the natural logarithm of the sum of the argument and 1.static Doublemedian(byte[] values)"Method median is not implemented yet"static Doublemedian(double[] values)"Method median is not implemented yet"static Floatmedian(float[] values)"Method median is not implemented yet"static Doublemedian(int[] values)"Method median is not implemented yet"static Doublemedian(long[] values)"Method median is not implemented yet"static Doublemedian(short[] values)"Method median is not implemented yet"static Doublemedian(Byte[] values)"Method median is not implemented yet"static Doublemedian(Double[] values)"Method median is not implemented yet"static Floatmedian(Float[] values)"Method median is not implemented yet"static Doublemedian(Integer[] values)"Method median is not implemented yet"static Doublemedian(Long[] values)"Method median is not implemented yet"static Doublemedian(Short[] values)"Method median is not implemented yet"static BigDecimalmedian(BigDecimal[] values)"Method median is not implemented yet"static BigDecimalmedian(BigInteger[] values)"Method median is not implemented yet"static Integerminute(Date d)static bytemod(byte number, byte divisor)static doublemod(double number, double divisor)static floatmod(float number, float divisor)static intmod(int number, int divisor)static longmod(long number, long divisor)static shortmod(short number, short divisor)static Bytemod(Byte number, Byte divisor)static Doublemod(Double number, Double divisor)static Floatmod(Float number, Float divisor)static Integermod(Integer number, Integer divisor)static Longmod(Long number, Long divisor)static Shortmod(Short number, Short divisor)static BigDecimalmod(BigDecimal number, BigDecimal divisor)static BigIntegermod(BigInteger number, BigInteger divisor)static Integermonth(Date d)static IntegermonthDiff(Date d1, Date d2)static doublenextAfter(double d)Returns the floating-point value adjacent todin the direction of positive infinity.static doublenextAfter(double start, double direction)Returns the floating-point number adjacent to the first argument in the direction of the second argument.static floatnextAfter(float f)Returns the floating-point value adjacent tofin the direction of positive infinity.static floatnextAfter(float start, float direction)Returns the floating-point number adjacent to the first argument in the direction of the second argument.static voidout(boolean output)static voidout(byte output)static voidout(char output)static voidout(double output)static voidout(float output)static voidout(int output)static voidout(long output)static voidout(short output)static voidout(Object output)static voidout(String output)static doubleparseFormattedDouble(String s)Deprecated.static doubleparseFormattedDouble(String s, String fmt)Deprecated.static doublepow(byte a, byte b)Returns the value of the first argument raised to the power of the second argument.static doublepow(double a, double b)static doublepow(float a, float b)static doublepow(int a, int b)static doublepow(long a, long b)static doublepow(short a, short b)static doublepow(Double a, Double b)static Integerquarter(Date d)static longquotient(byte number, byte divisor)static longquotient(double number, double divisor)static longquotient(float number, float divisor)static longquotient(int number, int divisor)static longquotient(long number, long divisor)static longquotient(short number, short divisor)static longquotient(Byte number, Byte divisor)Returns thestatic longquotient(Double number, Double divisor)static longquotient(Float number, Float divisor)static longquotient(Integer number, Integer divisor)static longquotient(Long number, Long divisor)static longquotient(Short number, Short divisor)static longquotient(BigDecimal number, BigDecimal divisor)static longquotient(BigInteger number, BigInteger divisor)static doublerandom()Returns adoublevalue with a positive sign, greater than or equal to0.0and less than1.0.static boolean[]remove(boolean[] array, int index)Removes the element at the specified position from the specified array.static byte[]remove(byte[] array, int index)Removes the element at the specified position from the specified array.static char[]remove(char[] array, int index)Removes the element at the specified position from the specified array.static double[]remove(double[] array, int index)Removes the element at the specified position from the specified array.static float[]remove(float[] array, int index)Removes the element at the specified position from the specified array.static int[]remove(int[] array, int index)Removes the element at the specified position from the specified array.static long[]remove(long[] array, int index)Removes the element at the specified position from the specified array.static short[]remove(short[] array, int index)Removes the element at the specified position from the specified array.static Boolean[]remove(Boolean[] array, int index)static Byte[]remove(Byte[] array, int index)static Character[]remove(Character[] array, int index)static Double[]remove(Double[] array, int index)static Float[]remove(Float[] array, int index)static Integer[]remove(Integer[] array, int index)static Long[]remove(Long[] array, int index)static Short[]remove(Short[] array, int index)static <T> T[]remove(T[] array, int index)Removes the element at the specified position from the specified array.static doublerint(double a)Returns thedoublevalue that is closest in value to the argument and is equal to a mathematical integer.static doublescalb(double d, int scaleFactor)Returnd× 2scaleFactorrounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set.static floatscalb(float f, int scaleFactor)Returnf× 2scaleFactorrounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set.static Integersecond(Date d)static doublesignum(double d)Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero.static doublesignum(float f)Returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero.static doublesin(double a)Returns the trigonometric sine of an angle.static doublesinh(double x)Returns the hyperbolic sine of adoublevalue.static Bytesmall(byte[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Doublesmall(double[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Floatsmall(float[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Integersmall(int[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Longsmall(long[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Shortsmall(short[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Bytesmall(Byte[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Doublesmall(Double[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Floatsmall(Float[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Integersmall(Integer[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Longsmall(Long[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static Shortsmall(Short[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static BigDecimalsmall(BigDecimal[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static BigIntegersmall(BigInteger[] values, int position)Removes null values from array, sorts an array in ascending order and returns the value at position 'position'static doublesqrt(double a)Returns the correctly rounded positive square root of adoublevalue.static ObjectstaticField(Object instance, String fieldName)static DatestringToDate(String value)Deprecated.static doubletan(double a)Returns the trigonometric tangent of an angle.static doubletanh(double x)Returns the hyperbolic tangent of adoublevalue.static doubletoDegrees(double angrad)Converts an angle measured in radians to an approximately equivalent angle measured in degrees.static doubletoRadians(double angdeg)Converts an angle measured in degrees to an approximately equivalent angle measured in radians.static doubleulp(double d)Returns the size of an ulp of the argument.static floatulp(float f)Returns the size of an ulp of the argument.static IntegerweekDiff(Date d1, Date d2)static IntegerweekOfMonth(Date d)static IntegerweekOfYear(Date d)static Integeryear(Date d)static IntegeryearDiff(Date d1, Date d2)
-
-
-
Field Detail
-
DEFAULT_DOUBLE_FORMAT
public static final String DEFAULT_DOUBLE_FORMAT
- See Also:
- Constant Field Values
-
E
public static final double E
- See Also:
- Constant Field Values
-
PI
public static final double PI
- See Also:
- Constant Field Values
-
-
Method Detail
-
small
public static Byte small(Byte[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Short small(Short[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Integer small(Integer[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Long small(Long[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Float small(Float[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Double small(Double[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static BigInteger small(BigInteger[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static BigDecimal small(BigDecimal[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Byte small(byte[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Short small(short[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Integer small(int[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Long small(long[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Float small(float[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
small
public static Double small(double[] values, int position)
Removes null values from array, sorts an array in ascending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Byte big(Byte[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Short big(Short[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Integer big(Integer[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Long big(Long[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Float big(Float[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Double big(Double[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static BigInteger big(BigInteger[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static BigDecimal big(BigDecimal[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Byte big(byte[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Short big(short[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Integer big(int[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Long big(long[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Float big(float[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
big
public static Double big(double[] values, int position)
Removes null values from array, sorts an array in descending order and returns the value at position 'position'
- Parameters:
values- an array, must not be null or emptyposition- array index whose value we wand to get- Returns:
- value from array at position 'position'
-
median
public static Double median(Byte[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(Short[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(Integer[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(Long[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Float median(Float[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(Double[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static BigDecimal median(BigInteger[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static BigDecimal median(BigDecimal[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(byte[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(short[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(int[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(long[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Float median(float[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
median
public static Double median(double[] values)
"Method median is not implemented yet"- Parameters:
values-- Returns:
-
quotient
public static long quotient(Byte number, Byte divisor)
Returns the- Parameters:
number-divisor-- Returns:
-
quotient
public static long quotient(BigInteger number, BigInteger divisor)
-
quotient
public static long quotient(BigDecimal number, BigDecimal divisor)
-
quotient
public static long quotient(byte number, byte divisor)
-
quotient
public static long quotient(short number, short divisor)
-
quotient
public static long quotient(int number, int divisor)
-
quotient
public static long quotient(long number, long divisor)
-
quotient
public static long quotient(float number, float divisor)
-
quotient
public static long quotient(double number, double divisor)
-
mod
public static BigInteger mod(BigInteger number, BigInteger divisor)
-
mod
public static BigDecimal mod(BigDecimal number, BigDecimal divisor)
-
mod
public static byte mod(byte number, byte divisor)
-
mod
public static short mod(short number, short divisor)
-
mod
public static int mod(int number, int divisor)
-
mod
public static long mod(long number, long divisor)
-
mod
public static float mod(float number, float divisor)
-
mod
public static double mod(double number, double divisor)
-
contains
public static <T> boolean contains(T[] array, T obj)Checks if the object is in the given array.
The method returns
falseif anullarray is passed in.- Parameters:
array- the array to search throughobj- the object to find- Returns:
trueif the array contains the object
-
contains
public static boolean contains(int[] array, int elem)Checks if the value is in the given array.
The method returns
falseif anullarray is passed in.- Parameters:
array- the array to search throughelem- the value to find- Returns:
trueif the array contains the object
-
contains
public static boolean contains(long[] array, long elem)Checks if the value is in the given array.
The method returns
falseif anullarray is passed in.- Parameters:
array- the array to search throughelem- the value to find- Returns:
trueif the array contains the object
-
contains
public static boolean contains(byte[] array, byte elem)Checks if the value is in the given array.
The method returns
falseif anullarray is passed in.- Parameters:
array- the array to search throughelem- the value to find- Returns:
trueif the array contains the object
-
contains
public static boolean contains(short[] array, short elem)Checks if the value is in the given array.
The method returns
falseif anullarray is passed in.- Parameters:
array- the array to search throughelem- the value to find- Returns:
trueif the array contains the object
-
contains
public static boolean contains(char[] array, char elem)Checks if the value is in the given array.
The method returns
falseif anullarray is passed in.- Parameters:
array- the array to search throughelem- the value to find- Returns:
trueif the array contains the object- Since:
- 2.1
-
contains
public static boolean contains(float[] array, float elem)Checks if the value is in the given array.
The method returns
falseif anullarray is passed in.- Parameters:
array- the array to search throughelem- the value to find- Returns:
trueif the array contains the object
-
contains
public static boolean contains(double[] array, double elem)Checks if the value is in the given array.
The method returns
falseif anullarray is passed in.- Parameters:
array- the array to search throughelem- the value to find- Returns:
trueif the array contains the object
-
contains
public static boolean contains(DoubleRange[] array, Double elem)
-
contains
public static boolean contains(StringRange[] array, CharSequence elem)
-
contains
public static boolean contains(StringRange[] array, String elem)
-
contains
public static boolean contains(boolean[] array, boolean elem)
-
contains
public static boolean contains(int[] ary1, int[] ary2)
-
contains
public static boolean contains(byte[] ary1, byte[] ary2)
-
contains
public static boolean contains(short[] ary1, short[] ary2)
-
contains
public static boolean contains(long[] ary1, long[] ary2)
-
contains
public static boolean contains(char[] ary1, char[] ary2)
-
contains
public static boolean contains(float[] ary1, float[] ary2)
-
contains
public static boolean contains(double[] ary1, double[] ary2)
-
contains
public static boolean contains(boolean[] ary1, boolean[] ary2)
-
contains
public static boolean contains(IntRange[] ary1, int[] ary2)
-
contains
public static boolean contains(DoubleRange[] ary1, Double[] ary2)
-
contains
public static boolean contains(DoubleRange[] ary1, double[] ary2)
-
contains
public static boolean contains(CharRange[] ary1, char[] ary2)
-
contains
public static boolean contains(StringRange[] ary1, CharSequence[] ary2)
-
contains
public static boolean contains(StringRange[] ary1, String[] ary2)
-
contains
public static boolean contains(IntRange range, BigInteger x)
-
contains
public static boolean contains(DoubleRange range, Double x)
-
contains
public static boolean contains(DoubleRange range, BigDecimal x)
-
contains
public static boolean contains(StringRange range, String x)
-
indexOf
public static int indexOf(Object[] array, Object obj)
Finds the index of the given object in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
array- the array to search through for the object, may benullobj- the object to find, may benull- Returns:
- the index of the object within the array,
ArrayUtils.INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
public static int indexOf(int[] array, int elem)Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
array- the array to search through for the object, may benullelem- the value to find- Returns:
- the index of the value within the array,
ArrayUtils.INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
public static int indexOf(long[] array, long elem)Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
array- the array to search through for the object, may benullelem- the value to find- Returns:
- the index of the value within the array,
ArrayUtils.INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
public static int indexOf(byte[] array, byte elem)Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
array- the array to search through for the object, may benullelem- the value to find- Returns:
- the index of the value within the array,
ArrayUtils.INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
public static int indexOf(short[] array, short elem)Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
array- the array to search through for the object, may benullelem- the value to find- Returns:
- the index of the value within the array,
ArrayUtils.INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
public static int indexOf(char[] array, char elem)Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
array- the array to search through for the object, may benullelem- the value to find- Returns:
- the index of the value within the array,
ArrayUtils.INDEX_NOT_FOUND(-1) if not found ornullarray input - Since:
- 2.1
-
indexOf
public static int indexOf(float[] array, float elem)Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
array- the array to search through for the object, may benullelem- the value to find- Returns:
- the index of the value within the array,
ArrayUtils.INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
public static int indexOf(double[] array, double elem)Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
array- the array to search through for the object, may benullelem- the value to find- Returns:
- the index of the value within the array,
ArrayUtils.INDEX_NOT_FOUND(-1) if not found ornullarray input
-
indexOf
public static int indexOf(boolean[] array, boolean elem)
-
format
@Deprecated public static String format(Date date)
Deprecated.method dateToString(Date date) should be used- Parameters:
date-- Returns:
- formated date value
-
format
@Deprecated public static String format(Date date, String format)
Deprecated.method dateToString (Date date, String format) should be used- Parameters:
date-format-- Returns:
- String formated date value
-
dateToString
@Deprecated public static String dateToString(Date date, String dateFormat)
Deprecated.converts a date to the String according dateFormat- Parameters:
date-dateFormat-- Returns:
- String formated date value
-
dateToString
@Deprecated public static String dateToString(Date date)
Deprecated.converts a date to the String according dateFormat- Parameters:
date- date to format- Returns:
- String formated date value
-
stringToDate
@Deprecated public static Date stringToDate(String value) throws ParseException
Deprecated.- Throws:
ParseException
-
format
public static String format(double d)
-
out
public static void out(String output)
-
out
public static void out(Object output)
-
out
public static void out(byte output)
-
out
public static void out(short output)
-
out
public static void out(int output)
-
out
public static void out(long output)
-
out
public static void out(float output)
-
out
public static void out(double output)
-
out
public static void out(char output)
-
out
public static void out(boolean output)
-
parseFormattedDouble
@Deprecated public static double parseFormattedDouble(String s) throws ParseException
Deprecated.Parse the represented string value to the double. Uses default Locale for it. Shouldn`t be used.- Throws:
ParseException
-
parseFormattedDouble
@Deprecated public static double parseFormattedDouble(String s, String fmt) throws ParseException
Deprecated.Parse the represented string value to the double. Uses default Locale for it. SeeDecimalFormat(String)Shouldn`t be used.- Throws:
ParseException
-
firstDateOfQuarter
public static Date firstDateOfQuarter(int absQuarter)
-
lastDateOfQuarter
public static Date lastDateOfQuarter(int absQuarter)
-
abs
public static double abs(double a)
Returns the absolute value of adoublevalue. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Special cases:- If the argument is positive zero or negative zero, the result is positive zero.
- If the argument is infinite, the result is positive infinity.
- If the argument is NaN, the result is NaN.
Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)- Parameters:
a- the argument whose absolute value is to be determined- Returns:
- the absolute value of the argument.
-
abs
public static float abs(float a)
Returns the absolute value of afloatvalue. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Special cases:- If the argument is positive zero or negative zero, the result is positive zero.
- If the argument is infinite, the result is positive infinity.
- If the argument is NaN, the result is NaN.
Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))- Parameters:
a- the argument whose absolute value is to be determined- Returns:
- the absolute value of the argument.
-
abs
public static int abs(int a)
Returns the absolute value of anintvalue. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Note that if the argument is equal to the value ofInteger.MIN_VALUE, the most negative representableintvalue, the result is that same value, which is negative.- Parameters:
a- the argument whose absolute value is to be determined- Returns:
- the absolute value of the argument.
-
abs
public static long abs(long a)
Returns the absolute value of alongvalue. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Note that if the argument is equal to the value ofLong.MIN_VALUE, the most negative representablelongvalue, the result is that same value, which is negative.- Parameters:
a- the argument whose absolute value is to be determined- Returns:
- the absolute value of the argument.
-
acos
public static double acos(double a)
Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi. Special case:- If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
- Parameters:
a- the value whose arc cosine is to be returned.- Returns:
- the arc cosine of the argument.
-
asin
public static double asin(double a)
Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2. Special cases:- If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
a- the value whose arc sine is to be returned.- Returns:
- the arc sine of the argument.
-
atan
public static double atan(double a)
Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2. Special cases:- If the argument is NaN, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
a- the value whose arc tangent is to be returned.- Returns:
- the arc tangent of the argument.
-
atan2
public static double atan2(double y, double x)Returns the angle theta from the conversion of rectangular coordinates (x,y) to polar coordinates (r, theta). This method computes the phase theta by computing an arc tangent ofy/xin the range of -pi to pi. Special cases:- If either argument is NaN, then the result is NaN.
- If the first argument is positive zero and the second argument is positive, or the first argument is positive and finite and the second argument is positive infinity, then the result is positive zero.
- If the first argument is negative zero and the second argument is positive, or the first argument is negative and finite and the second argument is positive infinity, then the result is negative zero.
- If the first argument is positive zero and the second argument is negative, or the first argument is positive
and finite and the second argument is negative infinity, then the result is the
doublevalue closest to pi. - If the first argument is negative zero and the second argument is negative, or the first argument is negative
and finite and the second argument is negative infinity, then the result is the
doublevalue closest to -pi. - If the first argument is positive and the second argument is positive zero or negative zero, or the first
argument is positive infinity and the second argument is finite, then the result is the
doublevalue closest to pi/2. - If the first argument is negative and the second argument is positive zero or negative zero, or the first
argument is negative infinity and the second argument is finite, then the result is the
doublevalue closest to -pi/2. - If both arguments are positive infinity, then the result is the
doublevalue closest to pi/4. - If the first argument is positive infinity and the second argument is negative infinity, then the result is
the
doublevalue closest to 3*pi/4. - If the first argument is negative infinity and the second argument is positive infinity, then the result is
the
doublevalue closest to -pi/4. - If both arguments are negative infinity, then the result is the
doublevalue closest to -3*pi/4.
- Parameters:
y- the ordinate coordinatex- the abscissa coordinate- Returns:
- the theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates.
-
cbrt
public static double cbrt(double a)
Returns the cube root of adoublevalue. For positive finitex,cbrt(-x) == -cbrt(x); that is, the cube root of a negative value is the negative of the cube root of that value's magnitude. Special cases:- If the argument is NaN, then the result is NaN.
- If the argument is infinite, then the result is an infinity with the same sign as the argument.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
a- a value.- Returns:
- the cube root of
a.
-
ceil
public static double ceil(double a)
Returns the smallest (closest to negative infinity)doublevalue that is greater than or equal to the argument and is equal to a mathematical integer. Special cases:- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
- If the argument value is less than zero but greater than -1.0, then the result is negative zero.
Math.ceil(x)is exactly the value of-Math.floor(-x).- Parameters:
a- a value.- Returns:
- the smallest (closest to negative infinity) floating-point value that is greater than or equal to the argument and is equal to a mathematical integer.
-
copySign
public static double copySign(double magnitude, double sign)Returns the first floating-point argument with the sign of the second floating-point argument. Note that unlike theStrictMath.copySignmethod, this method does not require NaNsignarguments to be treated as positive values; implementations are permitted to treat some NaN arguments as positive and other NaN arguments as negative to allow greater performance.- Parameters:
magnitude- the parameter providing the magnitude of the resultsign- the parameter providing the sign of the result- Returns:
- a value with the magnitude of
magnitudeand the sign ofsign.
-
copySign
public static float copySign(float magnitude, float sign)Returns the first floating-point argument with the sign of the second floating-point argument. Note that unlike theStrictMath.copySignmethod, this method does not require NaNsignarguments to be treated as positive values; implementations are permitted to treat some NaN arguments as positive and other NaN arguments as negative to allow greater performance.- Parameters:
magnitude- the parameter providing the magnitude of the resultsign- the parameter providing the sign of the result- Returns:
- a value with the magnitude of
magnitudeand the sign ofsign.
-
cos
public static double cos(double a)
Returns the trigonometric cosine of an angle. Special cases:- If the argument is NaN or an infinity, then the result is NaN.
- Parameters:
a- an angle, in radians.- Returns:
- the cosine of the argument.
-
cosh
public static double cosh(double x)
Returns the hyperbolic cosine of adoublevalue. The hyperbolic cosine of x is defined to be (ex + e-x)/2 where e is Euler's number. Special cases:- If the argument is NaN, then the result is NaN.
- If the argument is infinite, then the result is positive infinity.
- If the argument is zero, then the result is
1.0.
- Parameters:
x- The number whose hyperbolic cosine is to be returned.- Returns:
- The hyperbolic cosine of
x. - Since:
- 1.5
-
exp
public static double exp(double a)
Returns Euler's number e raised to the power of adoublevalue. Special cases:- If the argument is NaN, the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is negative infinity, then the result is positive zero.
- Parameters:
a- the exponent to raise e to.- Returns:
- the value e
a, where e is the base of the natural logarithms.
-
expm1
public static double expm1(double x)
Returns ex -1. Note that for values of x near 0, the exact sum ofexpm1(x)+ 1 is much closer to the true result of ex thanexp(x). Special cases:- If the argument is NaN, the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is negative infinity, then the result is -1.0.
- If the argument is zero, then the result is a zero with the same sign as the argument.
expm1for any finite input must be greater than or equal to-1.0. Note that once the exact result of ex- 1 is within 1/2 ulp of the limit value -1,-1.0should be returned.- Parameters:
x- the exponent to raise e to in the computation of ex-1.- Returns:
- the value e
x- 1.
-
floor
public static double floor(double a)
Returns the largest (closest to positive infinity)doublevalue that is less than or equal to the argument and is equal to a mathematical integer. Special cases:- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
- Parameters:
a- a value.- Returns:
- the largest (closest to positive infinity) floating-point value that less than or equal to the argument and is equal to a mathematical integer.
-
getExponent
public static int getExponent(double d)
Returns the unbiased exponent used in the representation of adouble. Special cases:- If the argument is NaN or infinite, then the result is
Double.MAX_EXPONENT+ 1. - If the argument is zero or subnormal, then the result is
Double.MIN_EXPONENT-1.
- Parameters:
d- adoublevalue- Returns:
- the unbiased exponent of the argument
- If the argument is NaN or infinite, then the result is
-
getExponent
public static int getExponent(float f)
Returns the unbiased exponent used in the representation of afloat. Special cases:- If the argument is NaN or infinite, then the result is
Float.MAX_EXPONENT+ 1. - If the argument is zero or subnormal, then the result is
Float.MIN_EXPONENT-1.
- Parameters:
f- afloatvalue- Returns:
- the unbiased exponent of the argument
- If the argument is NaN or infinite, then the result is
-
getExponent
public static double getExponent(double x, double y)Returns sqrt(x2 +y2) without intermediate overflow or underflow. Special cases:- If either argument is infinite, then the result is positive infinity.
- If either argument is NaN and neither argument is infinite, then the result is NaN.
- Parameters:
x- a valuey- a value- Returns:
- sqrt(x2 +y2) without intermediate overflow or underflow
-
IEEEremainder
public static double IEEEremainder(double f1, double f2)Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. The remainder value is mathematically equal tof1 - f2× n, where n is the mathematical integer closest to the exact mathematical value of the quotientf1/f2, and if two mathematical integers are equally close tof1/f2, then n is the integer that is even. If the remainder is zero, its sign is the same as the sign of the first argument. Special cases:- If either argument is NaN, or the first argument is infinite, or the second argument is positive zero or negative zero, then the result is NaN.
- If the first argument is finite and the second argument is infinite, then the result is the same as the first argument.
- Parameters:
f1- the dividend.f2- the divisor.- Returns:
- the remainder when
f1is divided byf2.
-
log
public static double log(double a)
Returns the natural logarithm (base e) of adoublevalue. Special cases:- If the argument is NaN or less than zero, then the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is positive zero or negative zero, then the result is negative infinity.
- Parameters:
a- a value- Returns:
- the value ln
a, the natural logarithm ofa.
-
log10
public static double log10(double a)
Returns the base 10 logarithm of adoublevalue. Special cases:- If the argument is NaN or less than zero, then the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is positive zero or negative zero, then the result is negative infinity.
- If the argument is equal to 10n for integer n, then the result is n.
- Parameters:
a- a value- Returns:
- the base 10 logarithm of
a.
-
log1p
public static double log1p(double x)
Returns the natural logarithm of the sum of the argument and 1. Note that for small valuesx, the result oflog1p(x)is much closer to the true result of ln(1 +x) than the floating-point evaluation oflog(1.0+x). Special cases:- If the argument is NaN or less than -1, then the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is negative one, then the result is negative infinity.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
x- a value- Returns:
- the value ln(
x+ 1), the natural log ofx+ 1
-
nextAfter
public static double nextAfter(double start, double direction)Returns the floating-point number adjacent to the first argument in the direction of the second argument. If both arguments compare as equal the second argument is returned. Special cases:- If either argument is a NaN, then NaN is returned.
- If both arguments are signed zeros,
directionis returned unchanged (as implied by the requirement of returning the second argument if the arguments compare as equal). - If
startis ±Double.MIN_VALUEanddirectionhas a value such that the result should have a smaller magnitude, then a zero with the same sign asstartis returned. - If
startis infinite anddirectionhas a value such that the result should have a smaller magnitude,Double.MAX_VALUEwith the same sign asstartis returned. - If
startis equal to ±Double.MAX_VALUEanddirectionhas a value such that the result should have a larger magnitude, an infinity with same sign asstartis returned.
- Parameters:
start- starting floating-point valuedirection- value indicating which ofstart's neighbors orstartshould be returned- Returns:
- The floating-point number adjacent to
startin the direction ofdirection.
-
nextAfter
public static float nextAfter(float start, float direction)Returns the floating-point number adjacent to the first argument in the direction of the second argument. If both arguments compare as equal a value equivalent to the second argument is returned. Special cases:- If either argument is a NaN, then NaN is returned.
- If both arguments are signed zeros, a value equivalent to
directionis returned. - If
startis ±Float.MIN_VALUEanddirectionhas a value such that the result should have a smaller magnitude, then a zero with the same sign asstartis returned. - If
startis infinite anddirectionhas a value such that the result should have a smaller magnitude,Float.MAX_VALUEwith the same sign asstartis returned. - If
startis equal to ±Float.MAX_VALUEanddirectionhas a value such that the result should have a larger magnitude, an infinity with same sign asstartis returned.
- Parameters:
start- starting floating-point valuedirection- value indicating which ofstart's neighbors orstartshould be returned- Returns:
- The floating-point number adjacent to
startin the direction ofdirection.
-
nextAfter
public static float nextAfter(float f)
Returns the floating-point value adjacent tofin the direction of positive infinity. This method is semantically equivalent tonextAfter(f, Float.POSITIVE_INFINITY); however, anextUpimplementation may run faster than its equivalentnextAftercall. Special Cases:- If the argument is NaN, the result is NaN.
- If the argument is positive infinity, the result is positive infinity.
- If the argument is zero, the result is
Float.MIN_VALUE
- Parameters:
f- starting floating-point value- Returns:
- The adjacent floating-point value closer to positive infinity.
-
nextAfter
public static double nextAfter(double d)
Returns the floating-point value adjacent todin the direction of positive infinity. This method is semantically equivalent tonextAfter(d, Double.POSITIVE_INFINITY); however, anextUpimplementation may run faster than its equivalentnextAftercall. Special Cases:- If the argument is NaN, the result is NaN.
- If the argument is positive infinity, the result is positive infinity.
- If the argument is zero, the result is
Double.MIN_VALUE
- Parameters:
d- starting floating-point value- Returns:
- The adjacent floating-point value closer to positive infinity.
-
pow
public static double pow(byte a, byte b)Returns the value of the first argument raised to the power of the second argument. Special cases:- If the second argument is positive or negative zero, then the result is 1.0.
- If the second argument is 1.0, then the result is the same as the first argument.
- If the second argument is NaN, then the result is NaN.
- If the first argument is NaN and the second argument is nonzero, then the result is NaN.
- If
- the absolute value of the first argument is greater than 1 and the second argument is positive infinity, or
- the absolute value of the first argument is less than 1 and the second argument is negative infinity,
- If
- the absolute value of the first argument is greater than 1 and the second argument is negative infinity, or
- the absolute value of the first argument is less than 1 and the second argument is positive infinity,
- If the absolute value of the first argument equals 1 and the second argument is infinite, then the result is NaN.
- If
- the first argument is positive zero and the second argument is greater than zero, or
- the first argument is positive infinity and the second argument is less than zero,
- If
- the first argument is positive zero and the second argument is less than zero, or
- the first argument is positive infinity and the second argument is greater than zero,
- If
- the first argument is negative zero and the second argument is greater than zero but not a finite odd integer, or
- the first argument is negative infinity and the second argument is less than zero but not a finite odd integer,
- If
- the first argument is negative zero and the second argument is a positive finite odd integer, or
- the first argument is negative infinity and the second argument is a negative finite odd integer,
- If
- the first argument is negative zero and the second argument is less than zero but not a finite odd integer, or
- the first argument is negative infinity and the second argument is greater than zero but not a finite odd integer,
- If
- the first argument is negative zero and the second argument is a negative finite odd integer, or
- the first argument is negative infinity and the second argument is a positive finite odd integer,
- If the first argument is finite and less than zero
- if the second argument is a finite even integer, the result is equal to the result of raising the absolute value of the first argument to the power of the second argument
- if the second argument is a finite odd integer, the result is equal to the negative of the result of raising the absolute value of the first argument to the power of the second argument
- if the second argument is finite and not an integer, then the result is NaN.
- If both arguments are integers, then the result is exactly equal to the mathematical result of raising the
first argument to the power of the second argument if that result can in fact be represented exactly as a
doublevalue.
ceilor, equivalently, a fixed point of the methodfloor. A value is a fixed point of a one-argument method if and only if the result of applying the method to the value is equal to the value.) The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.- Parameters:
a- the base.b- the exponent.- Returns:
- the value
ab.
-
pow
public static double pow(short a, short b)
-
pow
public static double pow(int a, int b)
-
pow
public static double pow(long a, long b)
-
pow
public static double pow(float a, float b)
-
pow
public static double pow(double a, double b)
-
random
public static double random()
Returns adoublevalue with a positive sign, greater than or equal to0.0and less than1.0. Returned values are chosen pseudorandomly with (approximately) uniform distribution from that range. When this method is first called, it creates a single new pseudorandom-number generator, exactly as if by the expression
This new pseudorandom-number generator is used thereafter for all calls to this method and is used nowhere else. This method is properly synchronized to allow correct use by more than one thread. However, if many threads need to generate pseudorandom numbers at a great rate, it may reduce contention for each thread to have its own pseudorandom-number generator.new java.util.Random()- Returns:
- a pseudorandom
doublegreater than or equal to0.0and less than1.0.
-
rint
public static double rint(double a)
Returns thedoublevalue that is closest in value to the argument and is equal to a mathematical integer. If twodoublevalues that are mathematical integers are equally close, the result is the integer value that is even. Special cases:- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
- Parameters:
a- adoublevalue.- Returns:
- the closest floating-point value to
athat is equal to a mathematical integer.
-
scalb
public static double scalb(double d, int scaleFactor)Returnd× 2scaleFactorrounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set. See the Java Language Specification for a discussion of floating-point value sets. If the exponent of the result is betweenDouble.MIN_EXPONENTandDouble.MAX_EXPONENT, the answer is calculated exactly. If the exponent of the result would be larger thanDouble.MAX_EXPONENT, an infinity is returned. Note that if the result is subnormal, precision may be lost; that is, whenscalb(x, n)is subnormal,scalb(scalb(x, n), -n)may not equal x. When the result is non-NaN, the result has the same sign asd. Special cases:- If the first argument is NaN, NaN is returned.
- If the first argument is infinite, then an infinity of the same sign is returned.
- If the first argument is zero, then a zero of the same sign is returned.
- Parameters:
d- number to be scaled by a power of two.scaleFactor- power of 2 used to scaled- Returns:
d× 2scaleFactor
-
scalb
public static float scalb(float f, int scaleFactor)Returnf× 2scaleFactorrounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set. See the Java Language Specification for a discussion of floating-point value sets. If the exponent of the result is betweenFloat.MIN_EXPONENTandFloat.MAX_EXPONENT, the answer is calculated exactly. If the exponent of the result would be larger thanFloat.MAX_EXPONENT, an infinity is returned. Note that if the result is subnormal, precision may be lost; that is, whenscalb(x, n)is subnormal,scalb(scalb(x, n), -n)may not equal x. When the result is non-NaN, the result has the same sign asf. Special cases:- If the first argument is NaN, NaN is returned.
- If the first argument is infinite, then an infinity of the same sign is returned.
- If the first argument is zero, then a zero of the same sign is returned.
- Parameters:
f- number to be scaled by a power of two.scaleFactor- power of 2 used to scalef- Returns:
f× 2scaleFactor
-
signum
public static double signum(double d)
Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero. Special Cases:- If the argument is NaN, then the result is NaN.
- If the argument is positive zero or negative zero, then the result is the same as the argument.
- Parameters:
d- the floating-point value whose signum is to be returned- Returns:
- the signum function of the argument
-
signum
public static double signum(float f)
Returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero. Special Cases:- If the argument is NaN, then the result is NaN.
- If the argument is positive zero or negative zero, then the result is the same as the argument.
- Parameters:
f- the floating-point value whose signum is to be returned- Returns:
- the signum function of the argument
-
sin
public static double sin(double a)
Returns the trigonometric sine of an angle. Special cases:- If the argument is NaN or an infinity, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
a- an angle, in radians.- Returns:
- the sine of the argument.
-
sinh
public static double sinh(double x)
Returns the hyperbolic sine of adoublevalue. The hyperbolic sine of x is defined to be (ex - e-x)/2 where e is Euler's number. Special cases:- If the argument is NaN, then the result is NaN.
- If the argument is infinite, then the result is an infinity with the same sign as the argument.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
x- The number whose hyperbolic sine is to be returned.- Returns:
- The hyperbolic sine of
x.
-
sqrt
public static double sqrt(double a)
Returns the correctly rounded positive square root of adoublevalue. Special cases:- If the argument is NaN or less than zero, then the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is positive zero or negative zero, then the result is the same as the argument.
doublevalue closest to the true mathematical square root of the argument value.- Parameters:
a- a value.- Returns:
- the positive square root of
a. If the argument is NaN or less than zero, the result is NaN.
-
tan
public static double tan(double a)
Returns the trigonometric tangent of an angle. Special cases:- If the argument is NaN or an infinity, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
a- an angle, in radians.- Returns:
- the tangent of the argument.
-
tanh
public static double tanh(double x)
Returns the hyperbolic tangent of adoublevalue. The hyperbolic tangent of x is defined to be (ex - e- x)/(ex + e-x), in other words, sinh(x)/cosh(x). Note that the absolute value of the exact tanh is always less than 1. Special cases:- If the argument is NaN, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- If the argument is positive infinity, then the result is
+1.0. - If the argument is negative infinity, then the result is
-1.0.
tanhfor any finite input must have an absolute value less than or equal to 1. Note that once the exact result of tanh is within 1/2 of an ulp of the limit value of ±1, correctly signed ±1.0should be returned.- Parameters:
x- The number whose hyperbolic tangent is to be returned.- Returns:
- The hyperbolic tangent of
x.
-
toDegrees
public static double toDegrees(double angrad)
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. The conversion from radians to degrees is generally inexact; users should not expectcos(toRadians(90.0))to exactly equal0.0.- Parameters:
angrad- an angle, in radians- Returns:
- the measurement of the angle
angradin degrees.
-
toRadians
public static double toRadians(double angdeg)
Converts an angle measured in degrees to an approximately equivalent angle measured in radians. The conversion from degrees to radians is generally inexact.- Parameters:
angdeg- an angle, in degrees- Returns:
- the measurement of the angle
angdegin radians.
-
ulp
public static double ulp(double d)
Returns the size of an ulp of the argument. An ulp of adoublevalue is the positive distance between this floating-point value and thedoublevalue next larger in magnitude. Note that for non-NaN x,ulp(-x) == ulp(x). Special Cases:- If the argument is NaN, then the result is NaN.
- If the argument is positive or negative infinity, then the result is positive infinity.
- If the argument is positive or negative zero, then the result is
Double.MIN_VALUE. - If the argument is ±
Double.MAX_VALUE, then the result is equal to 2971.
- Parameters:
d- the floating-point value whose ulp is to be returned- Returns:
- the size of an ulp of the argument
-
ulp
public static float ulp(float f)
Returns the size of an ulp of the argument. An ulp of afloatvalue is the positive distance between this floating-point value and thefloatvalue next larger in magnitude. Note that for non-NaN x,ulp(-x) == ulp(x). Special Cases:- If the argument is NaN, then the result is NaN.
- If the argument is positive or negative infinity, then the result is positive infinity.
- If the argument is positive or negative zero, then the result is
Float.MIN_VALUE. - If the argument is ±
Float.MAX_VALUE, then the result is equal to 2104.
- Parameters:
f- the floating-point value whose ulp is to be returned- Returns:
- the size of an ulp of the argument
-
addIgnoreNull
@Deprecated public static <T> T[] addIgnoreNull(T[] array, int index, T element)
Deprecated.Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, a new one element array is returned whose component type is the same as the element.ArrayUtils.add(null, 0, null) = [null] ArrayUtils.add(null, 0, "a") = ["a"] ArrayUtils.add(["a"], 1, null) = ["a", null] ArrayUtils.add(["a"], 1, "b") = ["a", "b"] ArrayUtils.add(["a", "b"], 3, "c") = ["a", "b", "c"]
- Parameters:
array- the array to add the element to, may benullindex- the position of the new objectelement- the object to add- Returns:
- A new array containing the existing elements and the new element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index > array.length).
-
addIgnoreNull
@Deprecated public static <T> T[] addIgnoreNull(T[] array, T element)
Deprecated.Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, a new one element array is returned whose component type is the same as the element.ArrayUtils.add(null, 0, null) = [null] ArrayUtils.add(null, 0, "a") = ["a"] ArrayUtils.add(["a"], 1, null) = ["a", null] ArrayUtils.add(["a"], 1, "b") = ["a", "b"] ArrayUtils.add(["a", "b"], 3, "c") = ["a", "b", "c"]
- Parameters:
array- the array to add the element to, may benullelement- the object to add- Returns:
- A new array containing the existing elements and the new element
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index > array.length).
-
addArrayElementIgnoreNull
@Deprecated public static Object[] addArrayElementIgnoreNull(Object[] array, int index, Object element)
Deprecated.UseaddIgnoreNull(Object[], int, Object)instead.
-
addArrayElementIgnoreNull
@Deprecated public static Object[] addArrayElementIgnoreNull(Object[] array, Object element)
Deprecated.UseaddIgnoreNull(Object[], Object)instead.
-
remove
public static boolean[] remove(boolean[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove([true], 0) = [] ArrayUtils.remove([true, false], 0) = [false] ArrayUtils.remove([true, false], 1) = [true] ArrayUtils.remove([true, true, false], 1) = [true, false]
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
remove
public static byte[] remove(byte[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove([true], 0) = [] ArrayUtils.remove([true, false], 0) = [false] ArrayUtils.remove([true, false], 1) = [true] ArrayUtils.remove([true, true, false], 1) = [true, false]
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
remove
public static char[] remove(char[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove(['a'], 0) = [] ArrayUtils.remove(['a', 'b'], 0) = ['b'] ArrayUtils.remove(['a', 'b'], 1) = ['a'] ArrayUtils.remove(['a', 'b', 'c'], 1) = ['a', 'c']
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
remove
public static double[] remove(double[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove([1.1], 0) = [] ArrayUtils.remove([2.5, 6.0], 0) = [6.0] ArrayUtils.remove([2.5, 6.0], 1) = [2.5] ArrayUtils.remove([2.5, 6.0, 3.8], 1) = [2.5, 3.8]
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
remove
public static float[] remove(float[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove([1.1], 0) = [] ArrayUtils.remove([2.5, 6.0], 0) = [6.0] ArrayUtils.remove([2.5, 6.0], 1) = [2.5] ArrayUtils.remove([2.5, 6.0, 3.8], 1) = [2.5, 3.8]
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
remove
public static int[] remove(int[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove([1], 0) = [] ArrayUtils.remove([2, 6], 0) = [6] ArrayUtils.remove([2, 6], 1) = [2] ArrayUtils.remove([2, 6, 3], 1) = [2, 3]
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
remove
public static long[] remove(long[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove([1], 0) = [] ArrayUtils.remove([2, 6], 0) = [6] ArrayUtils.remove([2, 6], 1) = [2] ArrayUtils.remove([2, 6, 3], 1) = [2, 3]
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
remove
public static <T> T[] remove(T[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove(["a"], 0) = [] ArrayUtils.remove(["a", "b"], 0) = ["b"] ArrayUtils.remove(["a", "b"], 1) = ["a"] ArrayUtils.remove(["a", "b", "c"], 1) = ["a", "c"]
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
remove
public static short[] remove(short[] array, int index)Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).
This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.
If the input array is
null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.ArrayUtils.remove([1], 0) = [] ArrayUtils.remove([2, 6], 0) = [6] ArrayUtils.remove([2, 6], 1) = [2] ArrayUtils.remove([2, 6, 3], 1) = [2, 3]
- Parameters:
array- the array to remove the element from, may not benullindex- the position of the element to be removed- Returns:
- A new array containing the existing elements except the element at the specified position.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= array.length), or if the array isnull.
-
addAll
public static Object addAll(Object... arrays)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
arrays. When an array is returned, it is always a new array.RuleUtils.addAll(null, null) = [null, null] RuleUtils.addAll(array1, null) = cloned copy of array1 with additional null element in the end of array RuleUtils.addAll(null, array2) = cloned copy of array2 with additional null element in the beginning of the array RuleUtils.addAll([], []) = [] RuleUtils.addAll([null], [null]) = [null, null] RuleUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"]
- Parameters:
arrays- the arrays whose elements are added to the new array, may benull- Returns:
- The new array,
nullif both arrays arenull. The type of the new array is the same type of the arrays.
-
getValues
public static Object getValues(StaticDomainOpenClass staticDomainOpenClass)
-
copy
public static <T> T copy(T origin)
-
-