public static int readSignedInt(ByteInput in, int zwidth) {
    int result = 0;
    for (int i = zwidth; i >= 0; i--) {
      result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
    }
    result >>= (3 - zwidth) * 8;
    return result;
  }
Read a signed integer.

@param zwidth byte count minus one
android/android_framework/dex-maker/src/main/java/com/android/dex/EncodedValueCodec.java