// Wiggle around the exponentially increasing base. finalint LIMIT = (1 << 15); int base = 10000; while (base < Integer.MAX_VALUE / 10) { for (int d = -LIMIT; d < LIMIT; d++) { int c = base + d; if (c > 0) {
buildAndTest(c);
}
}
base *= 10;
}
for (int c = 1; c < LIMIT; c++) {
buildAndTest(Integer.MAX_VALUE - LIMIT + c);
}
}
privatestaticvoid buildAndTest(int c) { if (c <= 0) { thrownew IllegalArgumentException("Test bug: can only handle positives, " + c);
}
StringBuilder sbN = new StringBuilder();
StringBuilder sbP = new StringBuilder();
int t = c; while (t > 0) { char digit = (char) ('0' + (t % 10));
sbN.append(digit);
sbP.append(digit);
t = t / 10;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.