private static void checkInBounds(
      final String name, final BigInteger i, final BigInteger curveOrder) {
    if (i.compareTo(BigInteger.ONE) < 0) {
      throw new IllegalArgumentException(
          String.format("Invalid '%s' value, should be >= 1 but got %s", name, i));
    }

    if (i.compareTo(curveOrder) >= 0) {
      throw new IllegalArgumentException(
          String.format("Invalid '%s' value, should be < %s but got %s", curveOrder, name, i));
    }
  }
Creates a new signature object given its parameters.

@param r the 'r' part of the signature.
@param s the 's' part of the signature.
@param recId the recovery id part of the signature.
@param curveOrder The order (n) of the used curve
@return the created {@link SECPSignature} object.
@throws NullPointerException if {@code r} or {@code s} are {@code null}.
@throws IllegalArgumentException if any argument is invalid (for instance, {@code v} is neither
    27 or 28).
crypto/algorithms/src/main/java/org/hyperledger/besu/crypto/SECPSignature.java