public static float checkArgumentFinite(final float value, final String valueName) {
        if (Float.isNaN(value)) {
            throw new IllegalArgumentException(valueName + " must not be NaN");
        } else if (Float.isInfinite(value)) {
            throw new IllegalArgumentException(valueName + " must not be infinite");
        }

        return value;
    }
Ensures that the argument floating point value is a finite number.
A finite number is defined to be both representable (that is, not NaN) and
not infinite (that is neither positive or negative infinity).

@param value     a floating point value
@param valueName the name of the argument to use if the check fails
@return the validated floating point value
@throws IllegalArgumentException if {@code value} was not finite
android/android_framework/base/src/main/java/util/PreconditionUtils.java