private static ByteString encodeBigInteger(BigInteger i) {
    // Note that toBigEndianBytes() returns the minimal big-endian encoding using the two's
    // complement representation. This means that the encoding may have a leading zero.
    byte[] encoded = BigIntegerEncoding.toBigEndianBytes(i);
    return ByteString.copyFrom(encoded);
  }
Encodes a BigInteger using a big-endian encoding.
java_src/src/main/java/com/google/crypto/tink/signature/internal/RsaSsaPssProtoSerialization.java