DoubleUtils
This class provides various utility functions for Double and double primitive types. It includes methods for boxing and unboxing arrays of doubles, and for validating double values to ensure they are not NaN or infinite.
Methods
box(double[] array)
Converts a primitive double array into a Double object array (boxing).
unbox(Double[] array)
Converts a Double object array back into a primitive double array (unboxing).
validate(double value, String parameterName)
Validates a single double value. It throws an IllegalArgumentException if the value is NaN (Not a Number) or infinite. The parameterName is used in the exception message for better debugging.
validate(double... values)
Validates multiple double values in an array. It iterates through the array and calls validate(double value, String parameterName) for each element, throwing an IllegalArgumentException if any value is invalid.