the inner loop:
int serialIndex = 100000 + index;
String serial = serialPrefix + String.valueOf(serialIndex).substring(1);
this produces padded serial numbesr e.g. 00001, 03450. certainly not optimal... but will do for now ;)
this obviously limits the number of entities to 99999... converting to hex would increase the limit a bit, but the printer guys argued its too much of a hassle to check the correct sequences since its still done manually... ok, so be it...