Class RulesUtils


  • public final class RulesUtils
    extends Object
    This class is connected to rules and all these methods can be used from rules.
    Author:
    snshor
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static double abs​(double a)
      Returns the absolute value of a double value.
      static float abs​(float a)
      Returns the absolute value of a float value.
      static int abs​(int a)
      Returns the absolute value of an int value.
      static long abs​(long a)
      Returns the absolute value of a long value.
      static Integer absMonth​(Date d)  
      static Integer absQuarter​(Date d)  
      static double acos​(double a)
      Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi.
      static Object add​(Object... arrays)  
      static Object addAll​(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 String amPm​(Date d)
      Returns AM or PM
      static double asin​(double a)
      Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2.
      static double atan​(double a)
      Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2.
      static double atan2​(double y, double x)
      Returns the angle theta from the conversion of rectangular coordinates (xy) to polar coordinates (r, theta).
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      static double cbrt​(double a)
      Returns the cube root of a double value.
      static double ceil​(double a)
      Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
      static boolean contains​(boolean[] array, boolean elem)  
      static boolean contains​(boolean[] ary1, boolean[] ary2)  
      static boolean contains​(byte[] array, byte elem)
      Checks if the value is in the given array.
      static boolean contains​(byte[] ary1, byte[] ary2)  
      static boolean contains​(char[] array, char elem)
      Checks if the value is in the given array.
      static boolean contains​(char[] ary1, char[] ary2)  
      static boolean contains​(double[] array, double elem)
      Checks if the value is in the given array.
      static boolean contains​(double[] ary1, double[] ary2)  
      static boolean contains​(float[] array, float elem)
      Checks if the value is in the given array.
      static boolean contains​(float[] ary1, float[] ary2)  
      static boolean contains​(int[] array, int elem)
      Checks if the value is in the given array.
      static boolean contains​(int[] ary1, int[] ary2)  
      static boolean contains​(long[] array, long elem)
      Checks if the value is in the given array.
      static boolean contains​(long[] ary1, long[] ary2)  
      static boolean contains​(short[] array, short elem)
      Checks if the value is in the given array.
      static boolean contains​(short[] ary1, short[] ary2)  
      static boolean contains​(Boolean[] array, Boolean elem)  
      static boolean contains​(Boolean[] ary1, Boolean[] ary2)  
      static boolean contains​(Byte[] array, Byte elem)  
      static boolean contains​(Byte[] ary1, Byte[] ary2)  
      static boolean contains​(Character[] array, Character elem)  
      static boolean contains​(Character[] ary1, Character[] ary2)  
      static boolean contains​(Double[] array, Double elem)  
      static boolean contains​(Double[] ary1, Double[] ary2)  
      static boolean contains​(Float[] array, Float elem)  
      static boolean contains​(Float[] ary1, Float[] ary2)  
      static boolean contains​(Integer[] array, Integer elem)  
      static boolean contains​(Integer[] ary1, Integer[] ary2)  
      static boolean contains​(Long[] array, Long elem)  
      static boolean contains​(Long[] ary1, Long[] ary2)  
      static boolean contains​(Object[] ary1, Object[] ary2)  
      static boolean contains​(Short[] array, Short elem)  
      static boolean contains​(Short[] ary1, Short[] ary2)  
      static boolean contains​(String[] array, String elem)  
      static boolean contains​(String[] ary1, String[] ary2)  
      static boolean contains​(Date[] array, Date elem)  
      static boolean contains​(CharRange[] ary1, char[] ary2)  
      static boolean contains​(CharRange[] array, Character elem)  
      static boolean contains​(CharRange[] ary1, Character[] ary2)  
      static boolean contains​(CharRange range, Character x)  
      static boolean contains​(DateRange[] array, Date elem)  
      static boolean contains​(DateRange[] ary1, Date[] ary2)  
      static boolean contains​(DateRange range, Date x)  
      static boolean contains​(DoubleRange[] ary1, double[] ary2)  
      static boolean contains​(DoubleRange[] array, Double elem)  
      static boolean contains​(DoubleRange[] ary1, Double[] ary2)  
      static boolean contains​(DoubleRange range, Double x)  
      static boolean contains​(DoubleRange range, BigDecimal x)  
      static boolean contains​(IntRange[] ary1, int[] ary2)  
      static boolean contains​(IntRange[] array, Integer elem)  
      static boolean contains​(IntRange[] ary1, Integer[] ary2)  
      static boolean contains​(IntRange range, Long x)  
      static boolean contains​(IntRange range, BigInteger x)  
      static boolean contains​(StringRange[] array, CharSequence elem)  
      static boolean contains​(StringRange[] ary1, CharSequence[] ary2)  
      static boolean contains​(StringRange[] array, String elem)  
      static boolean contains​(StringRange[] ary1, String[] ary2)  
      static boolean contains​(StringRange range, String x)  
      static <T> boolean contains​(T[] array, T obj)
      Checks if the object is in the given array.
      static <T> T copy​(T origin)  
      static double copySign​(double magnitude, double sign)
      Returns the first floating-point argument with the sign of the second floating-point argument.
      static float copySign​(float magnitude, float sign)
      Returns the first floating-point argument with the sign of the second floating-point argument.
      static double cos​(double a)
      Returns the trigonometric cosine of an angle.
      static double cosh​(double x)
      Returns the hyperbolic cosine of a double value.
      static String dateToString​(Date date)
      Deprecated.
      static String dateToString​(Date date, String dateFormat)
      Deprecated.
      static Integer dayDiff​(Date d1, Date d2)  
      static Integer dayOfMonth​(Date d)  
      static Integer dayOfWeek​(Date d)  
      static Integer dayOfYear​(Date d)  
      static VOID error​(Object object)  
      static VOID error​(String msg)  
      static VOID error​(String code, String message)  
      static double exp​(double a)
      Returns Euler's number e raised to the power of a double value.
      static double expm1​(double x)
      Returns ex -1.
      static Date firstDateOfQuarter​(int absQuarter)  
      static Object[] flatten​(Object... data)  
      static double floor​(double a)
      Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
      static String format​(double d)  
      static String format​(double d, String fmt)  
      static String format​(Date date)
      Deprecated.
      static String format​(Date date, String format)
      Deprecated.
      static int getExponent​(double d)
      Returns the unbiased exponent used in the representation of a double.
      static double getExponent​(double x, double y)
      Returns sqrt(x2 +y2) without intermediate overflow or underflow.
      static int getExponent​(float f)
      Returns the unbiased exponent used in the representation of a float.
      static Object getValues​(StaticDomainOpenClass staticDomainOpenClass)  
      static Integer hour​(Date d)  
      static Integer hourOfDay​(Date d)  
      static double IEEEremainder​(double f1, double f2)
      Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
      static int indexOf​(boolean[] array, boolean elem)  
      static int indexOf​(byte[] array, byte elem)
      Finds the index of the given value in the array.
      static int indexOf​(char[] array, char elem)
      Finds the index of the given value in the array.
      static int indexOf​(double[] array, double elem)
      Finds the index of the given value in the array.
      static int indexOf​(float[] array, float elem)
      Finds the index of the given value in the array.
      static int indexOf​(int[] array, int elem)
      Finds the index of the given value in the array.
      static int indexOf​(long[] array, long elem)
      Finds the index of the given value in the array.
      static int indexOf​(short[] array, short elem)
      Finds the index of the given value in the array.
      static int indexOf​(Boolean[] array, Boolean elem)  
      static int indexOf​(Byte[] array, Byte elem)  
      static int indexOf​(Character[] array, Character elem)  
      static int indexOf​(Double[] array, Double elem)  
      static int indexOf​(Float[] array, Float elem)  
      static int indexOf​(Integer[] array, Integer elem)  
      static int indexOf​(Long[] array, Long elem)  
      static int indexOf​(Object[] array, Object obj)
      Finds the index of the given object in the array.
      static int indexOf​(Short[] array, Short elem)  
      static boolean instanceOf​(Object o, Class<?> clazz)  
      static String[] intersection​(String[] ary1, String[] ary2)  
      static Date lastDateOfQuarter​(int absQuarter)  
      static Integer lastDayOfMonth​(Date d)  
      static double log​(double a)
      Returns the natural logarithm (base e) of a double value.
      static double log10​(double a)
      Returns the base 10 logarithm of a double value.
      static double log1p​(double x)
      Returns the natural logarithm of the sum of the argument and 1.
      static Double median​(byte[] values)
      "Method median is not implemented yet"
      static Double median​(double[] values)
      "Method median is not implemented yet"
      static Float median​(float[] values)
      "Method median is not implemented yet"
      static Double median​(int[] values)
      "Method median is not implemented yet"
      static Double median​(long[] values)
      "Method median is not implemented yet"
      static Double median​(short[] values)
      "Method median is not implemented yet"
      static Double median​(Byte[] values)
      "Method median is not implemented yet"
      static Double median​(Double[] values)
      "Method median is not implemented yet"
      static Float median​(Float[] values)
      "Method median is not implemented yet"
      static Double median​(Integer[] values)
      "Method median is not implemented yet"
      static Double median​(Long[] values)
      "Method median is not implemented yet"
      static Double median​(Short[] values)
      "Method median is not implemented yet"
      static BigDecimal median​(BigDecimal[] values)
      "Method median is not implemented yet"
      static BigDecimal median​(BigInteger[] values)
      "Method median is not implemented yet"
      static Integer minute​(Date d)  
      static byte mod​(byte number, byte divisor)  
      static double mod​(double number, double divisor)  
      static float mod​(float number, float divisor)  
      static int mod​(int number, int divisor)  
      static long mod​(long number, long divisor)  
      static short mod​(short number, short divisor)  
      static Byte mod​(Byte number, Byte divisor)  
      static Double mod​(Double number, Double divisor)  
      static Float mod​(Float number, Float divisor)  
      static Integer mod​(Integer number, Integer divisor)  
      static Long mod​(Long number, Long divisor)  
      static Short mod​(Short number, Short divisor)  
      static BigDecimal mod​(BigDecimal number, BigDecimal divisor)  
      static BigInteger mod​(BigInteger number, BigInteger divisor)  
      static Integer month​(Date d)  
      static Integer monthDiff​(Date d1, Date d2)  
      static double nextAfter​(double d)
      Returns the floating-point value adjacent to d in the direction of positive infinity.
      static double nextAfter​(double start, double direction)
      Returns the floating-point number adjacent to the first argument in the direction of the second argument.
      static float nextAfter​(float f)
      Returns the floating-point value adjacent to f in the direction of positive infinity.
      static float nextAfter​(float start, float direction)
      Returns the floating-point number adjacent to the first argument in the direction of the second argument.
      static void out​(boolean output)  
      static void out​(byte output)  
      static void out​(char output)  
      static void out​(double output)  
      static void out​(float output)  
      static void out​(int output)  
      static void out​(long output)  
      static void out​(short output)  
      static void out​(Object output)  
      static void out​(String output)  
      static double parseFormattedDouble​(String s)
      Deprecated.
      static double parseFormattedDouble​(String s, String fmt)
      Deprecated.
      static double pow​(byte a, byte b)
      Returns the value of the first argument raised to the power of the second argument.
      static double pow​(double a, double b)  
      static double pow​(float a, float b)  
      static double pow​(int a, int b)  
      static double pow​(long a, long b)  
      static double pow​(short a, short b)  
      static double pow​(Double a, Double b)  
      static Integer quarter​(Date d)  
      static long quotient​(byte number, byte divisor)  
      static long quotient​(double number, double divisor)  
      static long quotient​(float number, float divisor)  
      static long quotient​(int number, int divisor)  
      static long quotient​(long number, long divisor)  
      static long quotient​(short number, short divisor)  
      static long quotient​(Byte number, Byte divisor)
      Returns the
      static long quotient​(Double number, Double divisor)  
      static long quotient​(Float number, Float divisor)  
      static long quotient​(Integer number, Integer divisor)  
      static long quotient​(Long number, Long divisor)  
      static long quotient​(Short number, Short divisor)  
      static long quotient​(BigDecimal number, BigDecimal divisor)  
      static long quotient​(BigInteger number, BigInteger divisor)  
      static double random()
      Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.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 double rint​(double a)
      Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
      static double scalb​(double d, int scaleFactor)
      Return d × 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set.
      static float scalb​(float f, int scaleFactor)
      Return f × 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set.
      static Integer second​(Date d)  
      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.
      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.
      static double sin​(double a)
      Returns the trigonometric sine of an angle.
      static double sinh​(double x)
      Returns the hyperbolic sine of a double value.
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      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'
      static double sqrt​(double a)
      Returns the correctly rounded positive square root of a double value.
      static Object staticField​(Object instance, String fieldName)  
      static Date stringToDate​(String value)
      Deprecated.
      static double tan​(double a)
      Returns the trigonometric tangent of an angle.
      static double tanh​(double x)
      Returns the hyperbolic tangent of a double value.
      static double toDegrees​(double angrad)
      Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
      static double toRadians​(double angdeg)
      Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
      static double ulp​(double d)
      Returns the size of an ulp of the argument.
      static float ulp​(float f)
      Returns the size of an ulp of the argument.
      static Integer weekDiff​(Date d1, Date d2)  
      static Integer weekOfMonth​(Date d)  
      static Integer weekOfYear​(Date d)  
      static Integer year​(Date d)  
      static Integer yearDiff​(Date d1, Date d2)  
    • 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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 empty
        position - 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​(Short number,
                                    Short divisor)
      • quotient

        public static long quotient​(Integer number,
                                    Integer 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)
      • 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 Byte mod​(Byte number,
                               Byte divisor)
      • mod

        public static Long mod​(Long number,
                               Long 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 false if a null array is passed in.

        Parameters:
        array - the array to search through
        obj - the object to find
        Returns:
        true if 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 false if a null array is passed in.

        Parameters:
        array - the array to search through
        elem - the value to find
        Returns:
        true if 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 false if a null array is passed in.

        Parameters:
        array - the array to search through
        elem - the value to find
        Returns:
        true if 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 false if a null array is passed in.

        Parameters:
        array - the array to search through
        elem - the value to find
        Returns:
        true if 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 false if a null array is passed in.

        Parameters:
        array - the array to search through
        elem - the value to find
        Returns:
        true if 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 false if a null array is passed in.

        Parameters:
        array - the array to search through
        elem - the value to find
        Returns:
        true if 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 false if a null array is passed in.

        Parameters:
        array - the array to search through
        elem - the value to find
        Returns:
        true if 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 false if a null array is passed in.

        Parameters:
        array - the array to search through
        elem - the value to find
        Returns:
        true if the array contains the object
      • contains

        public static boolean contains​(Byte[] array,
                                       Byte elem)
      • contains

        public static boolean contains​(Short[] array,
                                       Short elem)
      • contains

        public static boolean contains​(Integer[] array,
                                       Integer elem)
      • contains

        public static boolean contains​(Long[] array,
                                       Long elem)
      • contains

        public static boolean contains​(Float[] array,
                                       Float elem)
      • contains

        public static boolean contains​(Double[] array,
                                       Double elem)
      • contains

        public static boolean contains​(Date[] array,
                                       Date elem)
      • contains

        public static boolean contains​(String[] array,
                                       String elem)
      • contains

        public static boolean contains​(IntRange[] array,
                                       Integer elem)
      • contains

        public static boolean contains​(DateRange[] array,
                                       Date elem)
      • contains

        public static boolean contains​(Object[] ary1,
                                       Object[] ary2)
      • contains

        public static boolean contains​(boolean[] array,
                                       boolean elem)
      • contains

        public static boolean contains​(Boolean[] array,
                                       Boolean elem)
      • contains

        public static boolean contains​(int[] ary1,
                                       int[] ary2)
      • contains

        public static boolean contains​(Integer[] ary1,
                                       Integer[] ary2)
      • contains

        public static boolean contains​(byte[] ary1,
                                       byte[] ary2)
      • contains

        public static boolean contains​(Byte[] ary1,
                                       Byte[] ary2)
      • contains

        public static boolean contains​(short[] ary1,
                                       short[] ary2)
      • contains

        public static boolean contains​(Short[] ary1,
                                       Short[] ary2)
      • contains

        public static boolean contains​(long[] ary1,
                                       long[] 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​(Float[] ary1,
                                       Float[] ary2)
      • contains

        public static boolean contains​(String[] ary1,
                                       String[] ary2)
      • contains

        public static boolean contains​(double[] ary1,
                                       double[] ary2)
      • contains

        public static boolean contains​(Double[] ary1,
                                       Double[] ary2)
      • contains

        public static boolean contains​(boolean[] ary1,
                                       boolean[] ary2)
      • contains

        public static boolean contains​(Boolean[] ary1,
                                       Boolean[] ary2)
      • contains

        public static boolean contains​(IntRange[] ary1,
                                       Integer[] ary2)
      • contains

        public static boolean contains​(IntRange[] ary1,
                                       int[] ary2)
      • contains

        public static boolean contains​(DoubleRange[] ary1,
                                       double[] ary2)
      • contains

        public static boolean contains​(CharRange[] ary1,
                                       char[] ary2)
      • contains

        public static boolean contains​(DateRange[] ary1,
                                       Date[] ary2)
      • contains

        public static boolean contains​(IntRange range,
                                       Long x)
      • contains

        public static boolean contains​(DateRange range,
                                       Date 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 a null input array.

        Parameters:
        array - the array to search through for the object, may be null
        obj - the object to find, may be null
        Returns:
        the index of the object within the array, ArrayUtils.INDEX_NOT_FOUND (-1) if not found or null array 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 a null input array.

        Parameters:
        array - the array to search through for the object, may be null
        elem - the value to find
        Returns:
        the index of the value within the array, ArrayUtils.INDEX_NOT_FOUND (-1) if not found or null array 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 a null input array.

        Parameters:
        array - the array to search through for the object, may be null
        elem - the value to find
        Returns:
        the index of the value within the array, ArrayUtils.INDEX_NOT_FOUND (-1) if not found or null array 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 a null input array.

        Parameters:
        array - the array to search through for the object, may be null
        elem - the value to find
        Returns:
        the index of the value within the array, ArrayUtils.INDEX_NOT_FOUND (-1) if not found or null array 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 a null input array.

        Parameters:
        array - the array to search through for the object, may be null
        elem - the value to find
        Returns:
        the index of the value within the array, ArrayUtils.INDEX_NOT_FOUND (-1) if not found or null array 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 a null input array.

        Parameters:
        array - the array to search through for the object, may be null
        elem - the value to find
        Returns:
        the index of the value within the array, ArrayUtils.INDEX_NOT_FOUND (-1) if not found or null array 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 a null input array.

        Parameters:
        array - the array to search through for the object, may be null
        elem - the value to find
        Returns:
        the index of the value within the array, ArrayUtils.INDEX_NOT_FOUND (-1) if not found or null array 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 a null input array.

        Parameters:
        array - the array to search through for the object, may be null
        elem - the value to find
        Returns:
        the index of the value within the array, ArrayUtils.INDEX_NOT_FOUND (-1) if not found or null array input
      • indexOf

        public static int indexOf​(boolean[] array,
                                  boolean elem)
      • indexOf

        public static int indexOf​(Boolean[] array,
                                  Boolean elem)
      • indexOf

        public static int indexOf​(Byte[] array,
                                  Byte elem)
      • indexOf

        public static int indexOf​(Short[] array,
                                  Short elem)
      • indexOf

        public static int indexOf​(Long[] array,
                                  Long elem)
      • indexOf

        public static int indexOf​(Integer[] array,
                                  Integer elem)
      • indexOf

        public static int indexOf​(Float[] array,
                                  Float elem)
      • indexOf

        public static int indexOf​(Double[] array,
                                  Double elem)
      • error

        public static VOID error​(String msg)
      • error

        public static VOID error​(Object object)
      • 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
      • format

        public static String format​(double d)
      • format

        public static String format​(double d,
                                    String fmt)
      • 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
      • absMonth

        public static Integer absMonth​(Date d)
      • absQuarter

        public static Integer absQuarter​(Date d)
      • dayOfMonth

        public static Integer dayOfMonth​(Date d)
      • firstDateOfQuarter

        public static Date firstDateOfQuarter​(int absQuarter)
      • lastDateOfQuarter

        public static Date lastDateOfQuarter​(int absQuarter)
      • lastDayOfMonth

        public static Integer lastDayOfMonth​(Date d)
      • dayOfWeek

        public static Integer dayOfWeek​(Date d)
      • dayOfYear

        public static Integer dayOfYear​(Date d)
      • weekOfYear

        public static Integer weekOfYear​(Date d)
      • weekOfMonth

        public static Integer weekOfMonth​(Date d)
      • hour

        public static Integer hour​(Date d)
        Parameters:
        d - Date
        Returns:
        hour from 0 to 12
      • hourOfDay

        public static Integer hourOfDay​(Date d)
        Parameters:
        d - Date
        Returns:
        hour from 0 to 24
      • amPm

        public static String amPm​(Date d)
        Returns AM or PM
        Parameters:
        d - Date
        Returns:
        AM or PM
      • abs

        public static double abs​(double a)
        Returns the absolute value of a double value. 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.
        In other words, the result is the same as the value of the expression:

        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 a float value. 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.
        In other words, the result is the same as the value of the expression:

        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 an int value. 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 of Integer.MIN_VALUE, the most negative representable int value, 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 a long value. 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 of Long.MIN_VALUE , the most negative representable long value, 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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        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 (xy) to polar coordinates (r, theta). This method computes the phase theta by computing an arc tangent of y/x in 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 double value 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 double value 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 double value 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 double value closest to -pi/2.
        • If both arguments are positive infinity, then the result is the double value closest to pi/4.
        • If the first argument is positive infinity and the second argument is negative infinity, then the result is the double value closest to 3*pi/4.
        • If the first argument is negative infinity and the second argument is positive infinity, then the result is the double value closest to -pi/4.
        • If both arguments are negative infinity, then the result is the double value closest to -3*pi/4.

        The computed result must be within 2 ulps of the exact result. Results must be semi-monotonic.

        Parameters:
        y - the ordinate coordinate
        x - the abscissa coordinate
        Returns:
        the theta component of the point (rtheta) in polar coordinates that corresponds to the point (xy) in Cartesian coordinates.
      • cbrt

        public static double cbrt​(double a)
        Returns the cube root of a double value. For positive finite x, 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.

        The computed result must be within 1 ulp of the exact result.

        Parameters:
        a - a value.
        Returns:
        the cube root of a.
      • ceil

        public static double ceil​(double a)
        Returns the smallest (closest to negative infinity) double value 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.
        Note that the value of 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 the StrictMath.copySign method, this method does not require NaN sign arguments 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 result
        sign - the parameter providing the sign of the result
        Returns:
        a value with the magnitude of magnitude and the sign of sign.
      • 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 the StrictMath.copySign method, this method does not require NaN sign arguments 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 result
        sign - the parameter providing the sign of the result
        Returns:
        a value with the magnitude of magnitude and the sign of sign.
      • 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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        Parameters:
        a - an angle, in radians.
        Returns:
        the cosine of the argument.
      • cosh

        public static double cosh​(double x)
        Returns the hyperbolic cosine of a double value. 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.

        The computed result must be within 2.5 ulps of the exact result.

        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 a double value. 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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        Parameters:
        a - the exponent to raise e to.
        Returns:
        the value ea, 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 of expm1(x) + 1 is much closer to the true result of ex than exp(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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic. The result of expm1 for 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.0 should be returned.

        Parameters:
        x - the exponent to raise e to in the computation of ex -1.
        Returns:
        the value ex - 1.
      • floor

        public static double floor​(double a)
        Returns the largest (closest to positive infinity) double value 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 a double. Special cases:

        Parameters:
        d - a double value
        Returns:
        the unbiased exponent of the argument
      • getExponent

        public static int getExponent​(float f)
        Returns the unbiased exponent used in the representation of a float. Special cases:

        Parameters:
        f - a float value
        Returns:
        the unbiased exponent of the argument
      • 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.

        The computed result must be within 1 ulp of the exact result. If one parameter is held constant, the results must be semi-monotonic in the other parameter.

        Parameters:
        x - a value
        y - 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 to f1 - f2 × n, where n is the mathematical integer closest to the exact mathematical value of the quotient f1/f2, and if two mathematical integers are equally close to f1/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 f1 is divided by f2.
      • log

        public static double log​(double a)
        Returns the natural logarithm (base e) of a double value. 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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        Parameters:
        a - a value
        Returns:
        the value ln a, the natural logarithm of a.
      • log10

        public static double log10​(double a)
        Returns the base 10 logarithm of a double value. 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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        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 values x, the result of log1p(x) is much closer to the true result of ln(1 + x) than the floating-point evaluation of log(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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        Parameters:
        x - a value
        Returns:
        the value ln(x + 1), the natural log of x + 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, direction is returned unchanged (as implied by the requirement of returning the second argument if the arguments compare as equal).

        • If start is ±Double.MIN_VALUE and direction has a value such that the result should have a smaller magnitude, then a zero with the same sign as start is returned.

        • If start is infinite and direction has a value such that the result should have a smaller magnitude, Double.MAX_VALUE with the same sign as start is returned.

        • If start is equal to ± Double.MAX_VALUE and direction has a value such that the result should have a larger magnitude, an infinity with same sign as start is returned.
        Parameters:
        start - starting floating-point value
        direction - value indicating which of start's neighbors or start should be returned
        Returns:
        The floating-point number adjacent to start in the direction of direction.
      • 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 direction is returned.

        • If start is ±Float.MIN_VALUE and direction has a value such that the result should have a smaller magnitude, then a zero with the same sign as start is returned.

        • If start is infinite and direction has a value such that the result should have a smaller magnitude, Float.MAX_VALUE with the same sign as start is returned.

        • If start is equal to ± Float.MAX_VALUE and direction has a value such that the result should have a larger magnitude, an infinity with same sign as start is returned.
        Parameters:
        start - starting floating-point value
        direction - value indicating which of start's neighbors or start should be returned
        Returns:
        The floating-point number adjacent to start in the direction of direction.
      • nextAfter

        public static float nextAfter​(float f)
        Returns the floating-point value adjacent to f in the direction of positive infinity. This method is semantically equivalent to nextAfter(f, Float.POSITIVE_INFINITY); however, a nextUp implementation may run faster than its equivalent nextAfter call.

        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 to d in the direction of positive infinity. This method is semantically equivalent to nextAfter(d, Double.POSITIVE_INFINITY); however, a nextUp implementation may run faster than its equivalent nextAfter call.

        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,
          then the result is positive 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,
          then the result is positive zero.

        • 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,
          then the result is positive 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,
          then the result is positive infinity.

        • 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,
          then the result is positive zero.

        • 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,
          then the result is negative zero.

        • 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,
          then the result is positive infinity.

        • 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,
          then the result is negative infinity.

        • 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 double value.

        (In the foregoing descriptions, a floating-point value is considered to be an integer if and only if it is finite and a fixed point of the method ceil or, equivalently, a fixed point of the method floor. 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 a double value with a positive sign, greater than or equal to 0.0 and less than 1.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

        new java.util.Random()

        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.

        Returns:
        a pseudorandom double greater than or equal to 0.0 and less than 1.0.
      • rint

        public static double rint​(double a)
        Returns the double value that is closest in value to the argument and is equal to a mathematical integer. If two double values 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 - a double value.
        Returns:
        the closest floating-point value to a that is equal to a mathematical integer.
      • scalb

        public static double scalb​(double d,
                                   int scaleFactor)
        Return d × 2scaleFactor rounded 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 between Double.MIN_EXPONENT and Double.MAX_EXPONENT, the answer is calculated exactly. If the exponent of the result would be larger than Double.MAX_EXPONENT, an infinity is returned. Note that if the result is subnormal, precision may be lost; that is, when scalb(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 as d.

        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 scale d
        Returns:
        d × 2scaleFactor
      • scalb

        public static float scalb​(float f,
                                  int scaleFactor)
        Return f × 2scaleFactor rounded 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 between Float.MIN_EXPONENT and Float.MAX_EXPONENT, the answer is calculated exactly. If the exponent of the result would be larger than Float.MAX_EXPONENT, an infinity is returned. Note that if the result is subnormal, precision may be lost; that is, when scalb(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 as f.

        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 scale f
        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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        Parameters:
        a - an angle, in radians.
        Returns:
        the sine of the argument.
      • sinh

        public static double sinh​(double x)
        Returns the hyperbolic sine of a double value. 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.

        The computed result must be within 2.5 ulps of the exact result.

        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 a double value. 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.
        Otherwise, the result is the double value 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.

        The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

        Parameters:
        a - an angle, in radians.
        Returns:
        the tangent of the argument.
      • tanh

        public static double tanh​(double x)
        Returns the hyperbolic tangent of a double value. 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.

        The computed result must be within 2.5 ulps of the exact result. The result of tanh for 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.0 should 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 expect cos(toRadians(90.0)) to exactly equal 0.0.
        Parameters:
        angrad - an angle, in radians
        Returns:
        the measurement of the angle angrad in 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 angdeg in radians.
      • ulp

        public static double ulp​(double d)
        Returns the size of an ulp of the argument. An ulp of a double value is the positive distance between this floating-point value and the double value 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 a float value is the positive distance between this floating-point value and the float value 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 be null
        index - the position of the new object
        element - 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 be null
        element - 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).
      • 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 be null
        index - 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 is null.
      • 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 be null
        index - 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 is null.
      • 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 be null
        index - 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 is null.
      • 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 be null
        index - 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 is null.
      • 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 be null
        index - 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 is null.
      • 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 be null
        index - 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 is null.
      • 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 be null
        index - 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 is null.
      • 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 be null
        index - 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 is null.
      • 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 be null
        index - 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 is null.
      • remove

        public static Byte[] remove​(Byte[] array,
                                    int index)
      • remove

        public static Short[] remove​(Short[] array,
                                     int index)
      • remove

        public static Integer[] remove​(Integer[] array,
                                       int index)
      • remove

        public static Long[] remove​(Long[] array,
                                    int index)
      • remove

        public static Float[] remove​(Float[] array,
                                     int index)
      • remove

        public static Double[] remove​(Double[] array,
                                      int index)
      • remove

        public static Boolean[] remove​(Boolean[] array,
                                       int index)
      • flatten

        public static Object[] flatten​(Object... data)
      • 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 be null
        Returns:
        The new array, null if both arrays are null. The type of the new array is the same type of the arrays.
      • instanceOf

        public static boolean instanceOf​(Object o,
                                         Class<?> clazz)
      • copy

        public static <T> T copy​(T origin)