List of usage examples for java.math BigInteger ONE
BigInteger ONE
To view the source code for java.math BigInteger ONE.
Click Source Link
From source file:com.otterca.common.crypto.acceptance.X509CertificateBuilderAcceptanceTest.java
/** * Test builder when 'notBefore' date is after 'notAfter' date. * /*from w w w. j a va 2s .c o m*/ * @throws Exception */ @Test(expectedExceptions = X509CertificateBuilderException.class) public void testBuilderBadDates() throws GeneralSecurityException { serial = serial.add(BigInteger.ONE); builder.setSerialNumber(serial); builder.setSubject(SUBJECT_NAME); builder.setIssuer(SUBJECT_NAME); builder.setNotBefore(notAfter.getTime()); builder.setNotAfter(notBefore.getTime()); builder.setPublicKey(keyPair.getPublic()); builder.build(keyPair.getPrivate()); }
From source file:net.pms.util.Rational.java
/** * Returns an instance with the given {@code numerator} and * {@code denominator}.//from w w w . j a v a 2s. co m * * @param numerator the numerator. * @param denominator the denominator. * @return An instance that represents the value of {@code numerator}/ * {@code denominator}. */ @Nullable public static Rational valueOf(@Nullable BigDecimal numerator, @Nullable BigDecimal denominator) { if (numerator == null || denominator == null) { return null; } if (numerator.signum() == 0 && denominator.signum() == 0) { return NaN; } if (denominator.signum() == 0) { return numerator.signum() > 0 ? POSITIVE_INFINITY : NEGATIVE_INFINITY; } if (numerator.signum() == 0) { return ZERO; } if (numerator.equals(denominator)) { return ONE; } if (denominator.signum() < 0) { numerator = numerator.negate(); denominator = denominator.negate(); } int scale = Math.max(numerator.scale(), denominator.scale()); if (scale > 0) { numerator = numerator.scaleByPowerOfTen(scale); denominator = denominator.scaleByPowerOfTen(scale); } BigInteger biNumerator = numerator.toBigIntegerExact(); BigInteger biDenominator = denominator.toBigIntegerExact(); BigInteger reducedNumerator; BigInteger reducedDenominator; BigInteger greatestCommonDivisor = calculateGreatestCommonDivisor(biNumerator, biDenominator); if (BigInteger.ONE.equals(greatestCommonDivisor)) { reducedNumerator = biNumerator; reducedDenominator = biDenominator; } else { reducedNumerator = biNumerator.divide(greatestCommonDivisor); reducedDenominator = biDenominator.divide(greatestCommonDivisor); } return new Rational(biNumerator, biDenominator, greatestCommonDivisor, reducedNumerator, reducedDenominator); }
From source file:cz.cas.lib.proarc.common.export.mets.JhoveUtility.java
/** * adds denominator value// www . j av a2 s. c o m * * @param jhoveOutput */ public static void addDenominator(JHoveOutput jhoveOutput) { if ((jhoveOutput != null) && (jhoveOutput.getMix() != null)) { if ((jhoveOutput.getMix().getImageAssessmentMetadata() != null) && (jhoveOutput.getMix().getImageAssessmentMetadata().getSpatialMetrics() != null)) { if ((jhoveOutput.getMix().getImageAssessmentMetadata().getSpatialMetrics() .getXSamplingFrequency() != null) && (jhoveOutput.getMix().getImageAssessmentMetadata().getSpatialMetrics() .getXSamplingFrequency().getDenominator() == null)) { jhoveOutput.getMix().getImageAssessmentMetadata().getSpatialMetrics().getXSamplingFrequency() .setDenominator(BigInteger.ONE); } if ((jhoveOutput.getMix().getImageAssessmentMetadata().getSpatialMetrics() .getXSamplingFrequency() != null) && (jhoveOutput.getMix().getImageAssessmentMetadata().getSpatialMetrics() .getYSamplingFrequency().getDenominator() == null)) { jhoveOutput.getMix().getImageAssessmentMetadata().getSpatialMetrics().getYSamplingFrequency() .setDenominator(BigInteger.ONE); } } } }
From source file:com.google.bitcoin.core.Block.java
/** * Returns the work represented by this block.<p> * * Work is defined as the number of tries needed to solve a block in the * average case. Consider a difficulty target that covers 5% of all possible * hash values. Then the work of the block will be 20. As the target gets * lower, the amount of work goes up.// w w w. jav a 2s . c o m */ public BigInteger getWork() throws VerificationException { BigInteger target = getDifficultyTargetAsInteger(); return LARGEST_HASH.divide(target.add(BigInteger.ONE)); }
From source file:org.apache.cassandra.cql.jdbc.HandleObjects.java
public static final ByteBuffer makeBytes(Object object, int baseType, int scaleOrLength) throws SQLException { Class<? extends Object> objectClass = object.getClass(); boolean isCollection = (Collection.class.isAssignableFrom(objectClass)); int targetSqlType = isCollection ? Types.OTHER : baseType; // Type check first switch (targetSqlType) { case Types.TINYINT: // Only Numeric classes, Strings and Booleans are supported for transformation to TINYINT if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "TINYINT"); break;//from w w w . j av a 2 s .c om case Types.SMALLINT: // Only Numeric classes, Strings and Booleans are supported for transformation to SMALLINT if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "SMALLINT"); break; case Types.INTEGER: // Only Numeric classes, Strings and Booleans are supported for transformation to INTEGER if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "INTEGER"); break; case Types.BIGINT: // Only Numeric classes, Strings and Booleans are supported for transformation to BIGINT if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "BIGINT"); break; case Types.REAL: case Types.FLOAT: case Types.DOUBLE: case Types.DECIMAL: // Only Numeric classes Strings and Booleans are supported for transformation to REAL,FLOAT,DOUBLE,DECIMAL if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "the floating point types"); break; case Types.NUMERIC: //NB This as a special case variation for Cassandra!! NUMERIC is transformed to java BigInteger (varint CQL type) // // Only Numeric classes Strings and Booleans are supported for transformation to NUMERIC if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "NUMERIC"); break; case Types.BIT: // Only Numeric classes Strings and Booleans are supported for transformation to BIT if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "BIT"); break; case Types.BOOLEAN: // Only Numeric classes Strings and Booleans are supported for transformation to BOOLEAN if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "BOOLEAN"); break; case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: if (!objectClass.isAssignableFrom(String.class)) throw makeBadMapping(objectClass, "String", "the various VARCHAR types"); break; case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: if (!(objectClass.isAssignableFrom(ByteBuffer.class) || objectClass.getSimpleName().equals("byte[]"))) throw makeBadMapping(objectClass, "ByteBuffer or byte[]", "the BINARY Types"); break; case Types.DATE: if (!(objectClass == String.class || objectClass == java.util.Date.class || objectClass == Date.class || objectClass == Timestamp.class)) throw makeBadMapping(objectClass, "String, Date(java and sql) or Timestamp types", "DATE"); break; case Types.TIME: if (!(objectClass == String.class || objectClass == java.util.Date.class || objectClass == Time.class || objectClass == Timestamp.class)) throw makeBadMapping(objectClass, "String, Date (java), Time or Timestamp types", "TIME"); break; case Types.TIMESTAMP: if (!(objectClass == String.class || objectClass == java.util.Date.class || objectClass == Date.class || objectClass == Timestamp.class)) throw makeBadMapping(objectClass, "String, Date(java and sql) or Timestamp types", "TIMESTAMP"); break; case Types.DATALINK: if (objectClass != URL.class) throw makeBadMapping(objectClass, "a URL type", "DATALINK"); break; case Types.JAVA_OBJECT: break; case Types.OTHER: // Only Collection classes for transformation to OTHER if (!(List.class.isAssignableFrom(object.getClass()) || Set.class.isAssignableFrom(object.getClass()) || Map.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "OTHER"); break; case Types.ROWID: if (objectClass != RowId.class) throw makeBadMapping(objectClass, "a RowId type", "ROWID"); break; default: throw new SQLNonTransientException("Unsupported transformation to Jdbc Type: " + targetSqlType); } // see if we can map to an supported Type switch (targetSqlType) { case Types.BIT: BigInteger bitvalue = objectToBITorTINYINTorSMALLINTorNUMERIC(objectClass, object); assert bitvalue != null; return JdbcInteger.instance.decompose((bitvalue == BigInteger.ZERO) ? BigInteger.ZERO : BigInteger.ONE); case Types.TINYINT: case Types.SMALLINT: case Types.NUMERIC: BigInteger varint = objectToBITorTINYINTorSMALLINTorNUMERIC(objectClass, object); assert varint != null; return JdbcInteger.instance.decompose(varint); case Types.INTEGER: Integer value = objectToINTEGER(objectClass, object); assert value != null; return JdbcInt32.instance.decompose(value); case Types.BIGINT: Long longvalue = objectToBIGINT(objectClass, object); assert longvalue != null; return JdbcLong.instance.decompose(longvalue); case Types.BOOLEAN: Boolean bool = objectToBOOLEAN(objectClass, object); assert bool != null; return JdbcBoolean.instance.decompose(bool); case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: return ByteBufferUtil.bytes((String) object); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: if (objectClass.isAssignableFrom(ByteBuffer.class)) { return ((ByteBuffer) object); } else if (objectClass.getSimpleName().equals("byte[]")) { return ByteBuffer.wrap((byte[]) object); } else return null; // this should not happen case Types.DATE: case Types.TIME: case Types.TIMESTAMP: Long millis = objectToDATEorTIMEorTIMESTAMP(objectClass, object); assert millis != null; return JdbcLong.instance.decompose(millis); case Types.DATALINK: String urlAsString = ((URL) object).toExternalForm(); return JdbcUTF8.instance.decompose(urlAsString); case Types.JAVA_OBJECT: return javaObject(object); case Types.OTHER: if (List.class.isAssignableFrom(objectClass)) { return handleAsList(objectClass, object); } else if (Set.class.isAssignableFrom(objectClass)) { return handleAsSet(objectClass, object); } else if (Map.class.isAssignableFrom(objectClass)) { return handleAsMap(objectClass, object); } else return null; case Types.ROWID: byte[] bytes = ((RowId) object).getBytes(); return ByteBuffer.wrap(bytes); default: LOG.warn("Unhandled JDBC type: " + targetSqlType); return null; } }
From source file:org.nd4j.linalg.util.BigDecimalMath.java
/** * The exponential function./*from ww w . j av a 2 s . c o m*/ * * @param x the argument. * @return exp(x). * The precision of the result is implicitly defined by the precision in the argument. * 16 * In particular this means that "Invalid Operation" errors are thrown if catastrophic * cancellation of digits causes the result to have no valid digits left. */ static public BigDecimal exp(BigDecimal x) { /* To calculate the value if x is negative, use exp(-x) = 1/exp(x) */ if (x.compareTo(BigDecimal.ZERO) < 0) { final BigDecimal invx = exp(x.negate()); /* Relative error in inverse of invx is the same as the relative errror in invx. * This is used to define the precision of the result. */ MathContext mc = new MathContext(invx.precision()); return BigDecimal.ONE.divide(invx, mc); } else if (x.compareTo(BigDecimal.ZERO) == 0) { /* recover the valid number of digits from x.ulp(), if x hits the * zero. The x.precision() is 1 then, and does not provide this information. */ return scalePrec(BigDecimal.ONE, -(int) (Math.log10(x.ulp().doubleValue()))); } else { /* Push the number in the Taylor expansion down to a small * value where TAYLOR_NTERM terms will do. If x<1, the n-th term is of the order * x^n/n!, and equal to both the absolute and relative error of the result * since the result is close to 1. The x.ulp() sets the relative and absolute error * of the result, as estimated from the first Taylor term. * We want x^TAYLOR_NTERM/TAYLOR_NTERM! < x.ulp, which is guaranteed if * x^TAYLOR_NTERM < TAYLOR_NTERM*(TAYLOR_NTERM-1)*...*x.ulp. */ final double xDbl = x.doubleValue(); final double xUlpDbl = x.ulp().doubleValue(); if (Math.pow(xDbl, TAYLOR_NTERM) < TAYLOR_NTERM * (TAYLOR_NTERM - 1.0) * (TAYLOR_NTERM - 2.0) * xUlpDbl) { /* Add TAYLOR_NTERM terms of the Taylor expansion (Eulers sum formula) */ BigDecimal resul = BigDecimal.ONE; /* x^i */ BigDecimal xpowi = BigDecimal.ONE; /* i factorial */ BigInteger ifac = BigInteger.ONE; /* TAYLOR_NTERM terms to be added means we move x.ulp() to the right * for each power of 10 in TAYLOR_NTERM, so the addition wont add noise beyond * whats already in x. */ MathContext mcTay = new MathContext(err2prec(1., xUlpDbl / TAYLOR_NTERM)); for (int i = 1; i <= TAYLOR_NTERM; i++) { ifac = ifac.multiply(new BigInteger("" + i)); xpowi = xpowi.multiply(x); final BigDecimal c = xpowi.divide(new BigDecimal(ifac), mcTay); resul = resul.add(c); if (Math.abs(xpowi.doubleValue()) < i && Math.abs(c.doubleValue()) < 0.5 * xUlpDbl) { break; } } /* exp(x+deltax) = exp(x)(1+deltax) if deltax is <<1. So the relative error * in the result equals the absolute error in the argument. */ MathContext mc = new MathContext(err2prec(xUlpDbl / 2.)); return resul.round(mc); } else { /* Compute exp(x) = (exp(0.1*x))^10. Division by 10 does not lead * to loss of accuracy. */ int exSc = (int) (1.0 - Math.log10(TAYLOR_NTERM * (TAYLOR_NTERM - 1.0) * (TAYLOR_NTERM - 2.0) * xUlpDbl / Math.pow(xDbl, TAYLOR_NTERM)) / (TAYLOR_NTERM - 1.0)); BigDecimal xby10 = x.scaleByPowerOfTen(-exSc); BigDecimal expxby10 = exp(xby10); /* Final powering by 10 means that the relative error of the result * is 10 times the relative error of the base (First order binomial expansion). * This looses one digit. */ MathContext mc = new MathContext(expxby10.precision() - exSc); /* Rescaling the powers of 10 is done in chunks of a maximum of 8 to avoid an invalid operation 17 * response by the BigDecimal.pow library or integer overflow. */ while (exSc > 0) { int exsub = Math.min(8, exSc); exSc -= exsub; MathContext mctmp = new MathContext(expxby10.precision() - exsub + 2); int pex = 1; while (exsub-- > 0) { pex *= 10; } expxby10 = expxby10.pow(pex, mctmp); } return expxby10.round(mc); } } }
From source file:cc.redberry.core.number.Complex.java
@Override public Complex multiply(BigInteger bg) { return bg.compareTo(BigInteger.ONE) == 0 ? this : new Complex(real.multiply(bg), imaginary.multiply(bg)); }
From source file:cc.redberry.core.number.Complex.java
@Override public Complex divide(BigInteger bg) { return bg.compareTo(BigInteger.ONE) == 0 ? this : new Complex(real.divide(bg), imaginary.divide(bg)); }
From source file:org.fenixedu.treasury.services.integration.erp.ERPExporter.java
private Payment convertToSAFTPaymentDocument(SettlementNote document, Map<String, oecd.standardauditfile_tax.pt_1.Customer> baseCustomers, Map<String, oecd.standardauditfile_tax.pt_1.Product> productMap) { Payment payment = new Payment(); // Find the Customer in BaseCustomers oecd.standardauditfile_tax.pt_1.Customer customer = null; if (baseCustomers.containsKey(document.getDebtAccount().getCustomer().getCode())) { customer = baseCustomers.get(document.getDebtAccount().getCustomer().getCode()); } else {// w ww . j a va2s .c o m // If not found, create a new one and add it to baseCustomers customer = convertCustomerToSAFTCustomer(document.getDebtAccount().getCustomer()); baseCustomers.put(customer.getCustomerID(), customer); } // MovementDate DatatypeFactory dataTypeFactory; try { dataTypeFactory = DatatypeFactory.newInstance(); DateTime documentDate = document.getDocumentDate(); // SystemEntryDate payment.setSystemEntryDate(convertToXMLDateTime(dataTypeFactory, documentDate)); payment.setTransactionDate(convertToXMLDateTime(dataTypeFactory, documentDate)); // DocumentNumber payment.setPaymentRefNo(document.getUiDocumentNumber()); // CustomerID payment.setCustomerID(document.getDebtAccount().getCustomer().getCode()); // DocumentStatus /* * Deve ser preenchido com: ?N? ? Normal; Texto 1 ?T? ? Por conta de * terceiros; ?A? ? Documento anulado. */ SourceDocuments.Payments.Payment.DocumentStatus status = new SourceDocuments.Payments.Payment.DocumentStatus(); if (document.isAnnulled()) { status.setPaymentStatus("A"); } else { status.setPaymentStatus("N"); } status.setPaymentStatusDate(payment.getSystemEntryDate()); // status.setReason(""); // Utilizador responsvel pelo estado atual do docu-mento. status.setSourceID(document.getVersioningUpdatedBy()); // Deve ser preenchido com: // 'P' - Documento produzido na aplicacao; if (Boolean.TRUE.equals(document.getDocumentNumberSeries().getSeries().getExternSeries()) || Boolean.TRUE.equals(document.getDocumentNumberSeries().getSeries().getLegacy())) { status.setSourcePayment(SAFTPTSourcePayment.I); } else { status.setSourcePayment(SAFTPTSourcePayment.P); } payment.setDocumentStatus(status); //Check if is Rehimbursement/Payment if (Constants.isPositive(document.getTotalPayedAmount())) { //PaymentMethods for (PaymentEntry paymentEntry : document.getPaymentEntriesSet()) { PaymentMethod method = new PaymentMethod(); method.setPaymentAmount(paymentEntry.getPayedAmount().setScale(2, RoundingMode.HALF_EVEN)); method.setPaymentDate(payment.getTransactionDate()); method.setPaymentMechanism(convertToSAFTPaymentMechanism(paymentEntry.getPaymentMethod())); payment.getPaymentMethod().add(method); } payment.setSettlementType(SAFTPTSettlementType.NL); } else if (Constants.isPositive(document.getTotalReimbursementAmount())) { //Reimbursments for (ReimbursementEntry reimbursmentEntry : document.getReimbursementEntriesSet()) { PaymentMethod method = new PaymentMethod(); method.setPaymentAmount( reimbursmentEntry.getReimbursedAmount().setScale(2, RoundingMode.HALF_EVEN)); method.setPaymentDate(payment.getTransactionDate()); method.setPaymentMechanism(convertToSAFTPaymentMechanism(reimbursmentEntry.getPaymentMethod())); payment.getPaymentMethod().add(method); payment.setSettlementType(SAFTPTSettlementType.NR); } } else { payment.setSettlementType(SAFTPTSettlementType.NN); } payment.setSourceID(document.getVersioningCreator()); // DocumentTotals SourceDocuments.Payments.Payment.DocumentTotals docTotals = new SourceDocuments.Payments.Payment.DocumentTotals(); //Lines BigInteger i = BigInteger.ONE; for (SettlementEntry settlementEntry : document.getSettlemetEntriesSet()) { SourceDocuments.Payments.Payment.Line line = new SourceDocuments.Payments.Payment.Line(); line.setLineNumber(i); //SourceDocument SourceDocumentID sourceDocument = new SourceDocumentID(); sourceDocument.setLineNumber(BigInteger.valueOf(settlementEntry.getInvoiceEntry().getEntryOrder())); sourceDocument.setOriginatingON( settlementEntry.getInvoiceEntry().getFinantialDocument().getUiDocumentNumber()); sourceDocument.setInvoiceDate(convertToXMLDateTime(dataTypeFactory, settlementEntry.getInvoiceEntry().getFinantialDocument().getDocumentDate())); sourceDocument.setDescription(settlementEntry.getDescription()); line.getSourceDocumentID().add(sourceDocument); //SettlementAmount line.setSettlementAmount(BigDecimal.ZERO); if (settlementEntry.getInvoiceEntry().isDebitNoteEntry()) { line.setDebitAmount(settlementEntry.getTotalAmount()); } else if (settlementEntry.getInvoiceEntry().isCreditNoteEntry()) { line.setCreditAmount(settlementEntry.getTotalAmount()); } payment.getLine().add(line); i = i.add(BigInteger.ONE); } docTotals.setGrossTotal(document.getTotalAmount().setScale(2, RoundingMode.HALF_EVEN)); docTotals.setNetTotal(document.getTotalAmount().setScale(2, RoundingMode.HALF_EVEN)); docTotals.setTaxPayable(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_EVEN)); payment.setDocumentTotals(docTotals); // Period /* * Per?odo contabil?stico (Period) . . . . . . . . . . Deve ser * indicado o n?mero do m?s do per?odo de tributa??o, de ?1? a ?12?, * contado desde a data do in?cio. Pode ainda ser preenchido com * ?13?, ?14?, ?15? ou ?16? para movimentos efectuados no ?ltimo m?s * do per?odo de tributa??o, relacionados com o apuramento do * resultado. Ex.: movimentos de apuramentos de invent?rios, * deprecia??es, ajustamentos ou apuramentos de resultados. */ payment.setPeriod(document.getDocumentDate().getMonthOfYear()); // SourceID /* * C?digo do utilizador que registou o movimento (SourceID). */ payment.setSourceID(document.getVersioningCreator()); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } return payment; }
From source file:org.candlepin.util.X509CRLStreamWriter.java
/** * This method updates the crlNumber and authorityKeyIdentifier extensions. Any * other extensions are copied over unchanged. * @param extensions//from w w w. j a v a2s.c o m * @return * @throws IOException */ @SuppressWarnings("rawtypes") protected byte[] updateExtensions(byte[] obj) throws IOException { DERTaggedObject taggedExts = (DERTaggedObject) DERTaggedObject.fromByteArray(obj); DERSequence seq = (DERSequence) taggedExts.getObject(); ASN1EncodableVector modifiedExts = new ASN1EncodableVector(); // Now we need to read the extensions and find the CRL number and increment it, // and determine if its length changed. Enumeration objs = seq.getObjects(); while (objs.hasMoreElements()) { DERSequence ext = (DERSequence) objs.nextElement(); DERObjectIdentifier oid = (DERObjectIdentifier) ext.getObjectAt(0); if (X509Extension.cRLNumber.equals(oid)) { DEROctetString s = (DEROctetString) ext.getObjectAt(1); DERInteger i = (DERInteger) DERTaggedObject.fromByteArray(s.getOctets()); DERInteger newCrlNumber = new DERInteger(i.getValue().add(BigInteger.ONE)); X509Extension newNumberExt = new X509Extension(false, new DEROctetString(newCrlNumber.getDEREncoded())); ASN1EncodableVector crlNumber = new ASN1EncodableVector(); crlNumber.add(X509Extension.cRLNumber); crlNumber.add(newNumberExt.getValue()); modifiedExts.add(new DERSequence(crlNumber)); } else if (X509Extension.authorityKeyIdentifier.equals(oid)) { X509Extension newAuthorityKeyExt = new X509Extension(false, new DEROctetString(akiStructure.getDEREncoded())); ASN1EncodableVector aki = new ASN1EncodableVector(); aki.add(X509Extension.authorityKeyIdentifier); aki.add(newAuthorityKeyExt.getValue()); modifiedExts.add(new DERSequence(aki)); } else { modifiedExts.add(ext); } } DERSequence seqOut = new DERSequence(modifiedExts); DERTaggedObject out = new DERTaggedObject(true, 0, seqOut); return out.getDEREncoded(); }