code: protected byte[] I2OSP(BigInteger x, int xLen) {
  
          if (x == null) {
              throw new IllegalArgumentException("x");
          }
  
          if (xLen <= 0) {
              throw new IllegalArgumentException("xLen");
          }
  
          if (x.compareTo(TWO_FIVE_SIX.pow(xLen)) == 1) {
              throw new IllegalArgumentException("integer too large");
          }
  
          // Even if x is less than 256^xLen, sometiems x.toByteArray() returns 257 bytes with leading zero
          byte[] bigEndianBytes = x.toByteArray();
          byte[] bytes;
          if (bigEndianBytes.length == 257 && bigEndianBytes[0] == 0) {
              bytes = Arrays.copyOfRange(bigEndianBytes, 1, 257);
          } else {
              bytes = bigEndianBytes;
          }
  
          if (bytes.length > xLen) {
              throw new IllegalArgumentException("integer too large");
          }
  
          byte[] result = new byte[xLen];
  
          System.arraycopy(bytes, 0, result, xLen - bytes.length, bytes.length);
  
          return result;
      }
docs: /*
  See https://tools.ietf.org/html/rfc3447#section-4.1