parquet-common/src/main/java/org/apache/parquet/bytes/BytesUtils.java
public static int readZigZagVarInt(InputStream in) throws IOException {
    int raw = readUnsignedVarInt(in);
    int temp = (((raw << 31) >> 31) ^ raw) >> 1;
    return temp ^ (raw & (1 << 31));
  }
public static int readZigZagVarInt(InputStream in) throws IOException {
    int raw = readUnsignedVarInt(in);
    int temp = (((raw << 31) >> 31) ^ raw) >> 1;
    return temp ^ (raw & (1 << 31));
  }
public static int readZigZagVarInt ( InputStream in ) throws IOException { int raw = readUnsignedVarInt ( in ) ; int temp = ( ( ( raw << 31 ) >> 31 ) ^ raw ) >> 1 ; return temp ^ ( raw & ( 1 << 31 ) ) ; }
uses a trick mentioned in https://developers.google.com/protocol-buffers/docs/encoding to read zigZag encoded data
@param in an input stream
@return the value of a zig-zag varint read from the current position in the stream
@throws IOException if there is an exception while reading
uses a trick mentioned in https : // developers . google . com / protocol - buffers / docs / encoding to read zigZag encoded data