Java Utililty Methods Number Negate

List of utility methods to do Number Negate

Description

The list of methods to do Number Negate are organized into topic(s).

Method

int[]negate(int[] input)
negate
int x = input[0];
int j = input.length;
if (x == 0) {
    j++;
} else if (x < 0 && (x >>> 1) > 0) {
    j++;
int[] result = new int[j];
...
int[]negate(int[] x, int Max)
output all integers from the range [0,Max) that are not in the array
int[] ans = new int[Max - x.length];
int i = 0;
int c = 0;
for (int j = 0; j < x.length; ++j) {
    int v = x[j];
    for (; i < v; ++i)
        ans[c++] = i;
    ++i;
...
Stringnegate(String expr)
negate
if (expr.startsWith(NEG)) {
    return expr.substring(NEG.length() + 1, expr.length() - 1);
} else {
    return NEG + "(" + expr + ")";
Stringnegate(String string, String trueValue, String falseValue)
Returns the negated boolean value of the given string.
return emit(negate(parse(string, trueValue, falseValue)), trueValue, falseValue);
Stringnegate(String value)
Compute the "negated" string, which replaces the digits (0 becomes 9, 1 becomes 8, ...
return negate(new StringBuilder(value)).toString();
doublenegateExact(double a)
Returns the negation of the argument, throwing an exception if the result exceeds a double .
if (a == Double.MAX_VALUE || a == Double.MIN_VALUE) {
    throw new ArithmeticException("double overflow");
return -a;
StringnegateExpression(String expression)
negate Expression
String result = null;
if (expression.contains("" + TERM_DELIMITER) || expression.contains("" + FACTOR_DELIMITER)) {
    result = NEGATION_DELIMITER + "(" + expression + ")";
} else {
    if (expression.startsWith("!")) {
        result = expression.substring(1, expression.length());
    } else if (expression.endsWith("'")) {
        result = expression.substring(0, expression.length() - 1);
...
voidnegateInPlace(float[] in)
negate In Place
for (int i = 0; i < in.length; i++) {
    in[i] *= -1;
StringNegation(String StartIP, String netmask)
Negation
String[] temp1 = StartIP.trim().split("\\.");
String[] temp2 = netmask.trim().split("\\.");
int[] rets = new int[4];
for (int i = 0; i < 4; i++) {
    rets[i] = Integer.parseInt(temp1[i]) & Integer.parseInt(temp2[i]);
return rets[0] + "." + rets[1] + "." + rets[2] + "." + rets[3];
booleannegative(float a)
negative
return a <= -FLOAT_EPS;