public static ByteString toUnsignedIntByteString(BigInteger i) {
    byte[] twosComplement = i.toByteArray();
    if (twosComplement[0] == 0x00) {
      return ByteString.copyFrom(twosComplement, 1, twosComplement.length - 1);
    }
    return ByteString.copyFrom(twosComplement);
  }
Returns the unsigned byte representation of the input BigInteger. BigInteger's toByteArray
returns a two's complement representation of non-negative integers, which might include an
extra zero byte at position 0 (in big endian).
java_src/src/main/java/com/google/crypto/tink/signature/internal/SigUtil.java