List of utility methods to do Number Negate
Boolean | negate(Boolean _value) negate Boolean negatedValue; if (_value == null) { negatedValue = Boolean.TRUE; } else { negatedValue = Boolean.valueOf(!_value.booleanValue()); return negatedValue; |
Boolean | negate(Boolean bool) negate if (bool == null) { return null; return (bool ? Boolean.FALSE : Boolean.TRUE); |
Boolean | negate(Boolean bool) Negates the specified boolean. If BooleanUtils.negate(Boolean.TRUE) = Boolean.FALSE; BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE; BooleanUtils.negate(null) = null; if (bool == null) { return null; return (bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE); |
boolean[] | negate(boolean[] posit) negate boolean[] neg = new boolean[posit.length]; for (int i = 0; i < posit.length; i++) { neg[i] = !posit[i]; return neg; |
Comparable | negate(Comparable v) negate if (v.getClass() == String.class) { throw new IllegalArgumentException("Strings cannot be negated"); if (v instanceof Number) { Number nv = (Number) v; if (nv instanceof Double) return new Double(-nv.doubleValue()); if (nv instanceof Long) ... |
double[] | negate(double[] a) Returns a new array that contains the negated values of the given array. double[] n = new double[a.length]; for (int i = 0; i < a.length; i++) { n[i] = -a[i]; return n; |
double[] | negate(double[] output, double[] a) negate for (int i = output.length - 1; i >= 0; i--) { output[i] = -a[i]; return output; |
double[] | negate(double[] values) Return a double array with negated values double[] result = new double[values.length]; for (int i = 0; i < values.length; i++) { result[i] = -values[i]; return result; |
Boolean | negate(final Boolean bool) Method to negate a Boolean if (bool == null) { return null; return bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE; |
int[] | negate(int[] ar) negate int[] negated = new int[ar.length]; for (int i = 0; i < ar.length; i++) negated[i] = -ar[i]; return negated; |