for (Map.Entry<BigInteger, Integer> entry : numbers.entrySet()) {
BigInteger number = entry.getKey();
Integer size = entry.getValue();
if (size == Byte.SIZE) {
dos.writeByte(number.byteValue());
bytesWritten += Byte.SIZE / 8;
} else if (size == Short.SIZE) {
dos.writeShort(number.shortValue());
bytesWritten += Short.SIZE / 8;
} else if (size == Integer.SIZE) {