public static int readInt(final DataInput in) throws IOException {
		int b = in.readByte() & 0xFF;
		int n = b & 0x7F;

		if (b > 0x7F) {
			b = in.readByte() & 0xFF;
			n ^= (b & 0x7F) << 7;
			if (b > 0x7F) {
				b = in.readByte() & 0xFF;
				n ^= (b & 0x7F) << 14;
				if (b > 0x7F) {
					b = in.readByte() & 0xFF;
					n ^= (b & 0x7F) << 21;
					if (b > 0x7F) {
						b = in.readByte() & 0xFF;
						n ^= (b & 0x7F) << 28;
						if (b > 0x7F) {
							throw new IOException("Invalid int encoding.");
						}
					}
				}
			}
		}

		return (n >>> 1)^-(n & 1);
	}
Reads an int value from the given data input. The integer value must have
been written by the {@link #writeInt(int, DataOutput)} before.

@see #writeInt(int, DataOutput)

@param in the data input where the integer value is read from
@return the read integer value
@throws NullPointerException if the given data input is {@code null}
@throws IOException if an I/O error occurs
jenetics/src/main/java/io/jenetics/internal/util/SerialIO.java