boolean didIncrease = false;
for (int i = 0; i < latestParts.length; i++) {
if (didIncrease) {
if (formatParts.length > i) {
throw new SuperNannyError(
"Given format is not correct; cannot contain anything after the first +.");
}
// already increased, just pad 0
nextVersion.append(0);
} else if (formatParts[i].equals("x")) {
// use
nextVersion.append(latestParts[i]);
} else if (formatParts[i].equals("+")) {
// increase
if (!didIncrease) {
nextVersion.append(1 + Integer.parseInt(latestParts[i].toString()));
didIncrease = true;
} else {
throw new SuperNannyError(
"Given format is not correct; can only contain a single +.");
}
} else {
throw new SuperNannyError(
"Entered format is wrong; can only contain delimiters, + and x.");
}
// add the format delimiter if not last iteration
if (latestParts.length > i + 1) {