Remove unused java.math.* and javax.xml.* classes.

Change-Id: I5418e1e467c2431d709da7b2a11fbc8f05aa44b8
diff --git a/ojluni/src/main/java/java/math/BigDecimal.java b/ojluni/src/main/java/java/math/BigDecimal.java
deleted file mode 100755
index 0549890..0000000
--- a/ojluni/src/main/java/java/math/BigDecimal.java
+++ /dev/null
@@ -1,3855 +0,0 @@
-/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Portions Copyright IBM Corporation, 2001. All Rights Reserved.
- */
-
-package java.math;
-
-import java.util.Arrays;
-import static java.math.BigInteger.LONG_MASK;
-
-/**
- * Immutable, arbitrary-precision signed decimal numbers.  A
- * {@code BigDecimal} consists of an arbitrary precision integer
- * <i>unscaled value</i> and a 32-bit integer <i>scale</i>.  If zero
- * or positive, the scale is the number of digits to the right of the
- * decimal point.  If negative, the unscaled value of the number is
- * multiplied by ten to the power of the negation of the scale.  The
- * value of the number represented by the {@code BigDecimal} is
- * therefore <tt>(unscaledValue &times; 10<sup>-scale</sup>)</tt>.
- *
- * <p>The {@code BigDecimal} class provides operations for
- * arithmetic, scale manipulation, rounding, comparison, hashing, and
- * format conversion.  The {@link #toString} method provides a
- * canonical representation of a {@code BigDecimal}.
- *
- * <p>The {@code BigDecimal} class gives its user complete control
- * over rounding behavior.  If no rounding mode is specified and the
- * exact result cannot be represented, an exception is thrown;
- * otherwise, calculations can be carried out to a chosen precision
- * and rounding mode by supplying an appropriate {@link MathContext}
- * object to the operation.  In either case, eight <em>rounding
- * modes</em> are provided for the control of rounding.  Using the
- * integer fields in this class (such as {@link #ROUND_HALF_UP}) to
- * represent rounding mode is largely obsolete; the enumeration values
- * of the {@code RoundingMode} {@code enum}, (such as {@link
- * RoundingMode#HALF_UP}) should be used instead.
- *
- * <p>When a {@code MathContext} object is supplied with a precision
- * setting of 0 (for example, {@link MathContext#UNLIMITED}),
- * arithmetic operations are exact, as are the arithmetic methods
- * which take no {@code MathContext} object.  (This is the only
- * behavior that was supported in releases prior to 5.)  As a
- * corollary of computing the exact result, the rounding mode setting
- * of a {@code MathContext} object with a precision setting of 0 is
- * not used and thus irrelevant.  In the case of divide, the exact
- * quotient could have an infinitely long decimal expansion; for
- * example, 1 divided by 3.  If the quotient has a nonterminating
- * decimal expansion and the operation is specified to return an exact
- * result, an {@code ArithmeticException} is thrown.  Otherwise, the
- * exact result of the division is returned, as done for other
- * operations.
- *
- * <p>When the precision setting is not 0, the rules of
- * {@code BigDecimal} arithmetic are broadly compatible with selected
- * modes of operation of the arithmetic defined in ANSI X3.274-1996
- * and ANSI X3.274-1996/AM 1-2000 (section 7.4).  Unlike those
- * standards, {@code BigDecimal} includes many rounding modes, which
- * were mandatory for division in {@code BigDecimal} releases prior
- * to 5.  Any conflicts between these ANSI standards and the
- * {@code BigDecimal} specification are resolved in favor of
- * {@code BigDecimal}.
- *
- * <p>Since the same numerical value can have different
- * representations (with different scales), the rules of arithmetic
- * and rounding must specify both the numerical result and the scale
- * used in the result's representation.
- *
- *
- * <p>In general the rounding modes and precision setting determine
- * how operations return results with a limited number of digits when
- * the exact result has more digits (perhaps infinitely many in the
- * case of division) than the number of digits returned.
- *
- * First, the
- * total number of digits to return is specified by the
- * {@code MathContext}'s {@code precision} setting; this determines
- * the result's <i>precision</i>.  The digit count starts from the
- * leftmost nonzero digit of the exact result.  The rounding mode
- * determines how any discarded trailing digits affect the returned
- * result.
- *
- * <p>For all arithmetic operators , the operation is carried out as
- * though an exact intermediate result were first calculated and then
- * rounded to the number of digits specified by the precision setting
- * (if necessary), using the selected rounding mode.  If the exact
- * result is not returned, some digit positions of the exact result
- * are discarded.  When rounding increases the magnitude of the
- * returned result, it is possible for a new digit position to be
- * created by a carry propagating to a leading {@literal "9"} digit.
- * For example, rounding the value 999.9 to three digits rounding up
- * would be numerically equal to one thousand, represented as
- * 100&times;10<sup>1</sup>.  In such cases, the new {@literal "1"} is
- * the leading digit position of the returned result.
- *
- * <p>Besides a logical exact result, each arithmetic operation has a
- * preferred scale for representing a result.  The preferred
- * scale for each operation is listed in the table below.
- *
- * <table border>
- * <caption><b>Preferred Scales for Results of Arithmetic Operations
- * </b></caption>
- * <tr><th>Operation</th><th>Preferred Scale of Result</th></tr>
- * <tr><td>Add</td><td>max(addend.scale(), augend.scale())</td>
- * <tr><td>Subtract</td><td>max(minuend.scale(), subtrahend.scale())</td>
- * <tr><td>Multiply</td><td>multiplier.scale() + multiplicand.scale()</td>
- * <tr><td>Divide</td><td>dividend.scale() - divisor.scale()</td>
- * </table>
- *
- * These scales are the ones used by the methods which return exact
- * arithmetic results; except that an exact divide may have to use a
- * larger scale since the exact result may have more digits.  For
- * example, {@code 1/32} is {@code 0.03125}.
- *
- * <p>Before rounding, the scale of the logical exact intermediate
- * result is the preferred scale for that operation.  If the exact
- * numerical result cannot be represented in {@code precision}
- * digits, rounding selects the set of digits to return and the scale
- * of the result is reduced from the scale of the intermediate result
- * to the least scale which can represent the {@code precision}
- * digits actually returned.  If the exact result can be represented
- * with at most {@code precision} digits, the representation
- * of the result with the scale closest to the preferred scale is
- * returned.  In particular, an exactly representable quotient may be
- * represented in fewer than {@code precision} digits by removing
- * trailing zeros and decreasing the scale.  For example, rounding to
- * three digits using the {@linkplain RoundingMode#FLOOR floor}
- * rounding mode, <br>
- *
- * {@code 19/100 = 0.19   // integer=19,  scale=2} <br>
- *
- * but<br>
- *
- * {@code 21/110 = 0.190  // integer=190, scale=3} <br>
- *
- * <p>Note that for add, subtract, and multiply, the reduction in
- * scale will equal the number of digit positions of the exact result
- * which are discarded. If the rounding causes a carry propagation to
- * create a new high-order digit position, an additional digit of the
- * result is discarded than when no new digit position is created.
- *
- * <p>Other methods may have slightly different rounding semantics.
- * For example, the result of the {@code pow} method using the
- * {@linkplain #pow(int, MathContext) specified algorithm} can
- * occasionally differ from the rounded mathematical result by more
- * than one unit in the last place, one <i>{@linkplain #ulp() ulp}</i>.
- *
- * <p>Two types of operations are provided for manipulating the scale
- * of a {@code BigDecimal}: scaling/rounding operations and decimal
- * point motion operations.  Scaling/rounding operations ({@link
- * #setScale setScale} and {@link #round round}) return a
- * {@code BigDecimal} whose value is approximately (or exactly) equal
- * to that of the operand, but whose scale or precision is the
- * specified value; that is, they increase or decrease the precision
- * of the stored number with minimal effect on its value.  Decimal
- * point motion operations ({@link #movePointLeft movePointLeft} and
- * {@link #movePointRight movePointRight}) return a
- * {@code BigDecimal} created from the operand by moving the decimal
- * point a specified distance in the specified direction.
- *
- * <p>For the sake of brevity and clarity, pseudo-code is used
- * throughout the descriptions of {@code BigDecimal} methods.  The
- * pseudo-code expression {@code (i + j)} is shorthand for "a
- * {@code BigDecimal} whose value is that of the {@code BigDecimal}
- * {@code i} added to that of the {@code BigDecimal}
- * {@code j}." The pseudo-code expression {@code (i == j)} is
- * shorthand for "{@code true} if and only if the
- * {@code BigDecimal} {@code i} represents the same value as the
- * {@code BigDecimal} {@code j}." Other pseudo-code expressions
- * are interpreted similarly.  Square brackets are used to represent
- * the particular {@code BigInteger} and scale pair defining a
- * {@code BigDecimal} value; for example [19, 2] is the
- * {@code BigDecimal} numerically equal to 0.19 having a scale of 2.
- *
- * <p>Note: care should be exercised if {@code BigDecimal} objects
- * are used as keys in a {@link java.util.SortedMap SortedMap} or
- * elements in a {@link java.util.SortedSet SortedSet} since
- * {@code BigDecimal}'s <i>natural ordering</i> is <i>inconsistent
- * with equals</i>.  See {@link Comparable}, {@link
- * java.util.SortedMap} or {@link java.util.SortedSet} for more
- * information.
- *
- * <p>All methods and constructors for this class throw
- * {@code NullPointerException} when passed a {@code null} object
- * reference for any input parameter.
- *
- * @see     BigInteger
- * @see     MathContext
- * @see     RoundingMode
- * @see     java.util.SortedMap
- * @see     java.util.SortedSet
- * @author  Josh Bloch
- * @author  Mike Cowlishaw
- * @author  Joseph D. Darcy
- */
-public class BigDecimal extends Number implements Comparable<BigDecimal> {
-    /**
-     * The unscaled value of this BigDecimal, as returned by {@link
-     * #unscaledValue}.
-     *
-     * @serial
-     * @see #unscaledValue
-     */
-    private volatile BigInteger intVal;
-
-    /**
-     * The scale of this BigDecimal, as returned by {@link #scale}.
-     *
-     * @serial
-     * @see #scale
-     */
-    private int scale;  // Note: this may have any value, so
-                        // calculations must be done in longs
-    /**
-     * The number of decimal digits in this BigDecimal, or 0 if the
-     * number of digits are not known (lookaside information).  If
-     * nonzero, the value is guaranteed correct.  Use the precision()
-     * method to obtain and set the value if it might be 0.  This
-     * field is mutable until set nonzero.
-     *
-     * @since  1.5
-     */
-    private transient int precision;
-
-    /**
-     * Used to store the canonical string representation, if computed.
-     */
-    private transient String stringCache;
-
-    /**
-     * Sentinel value for {@link #intCompact} indicating the
-     * significand information is only available from {@code intVal}.
-     */
-    static final long INFLATED = Long.MIN_VALUE;
-
-    /**
-     * If the absolute value of the significand of this BigDecimal is
-     * less than or equal to {@code Long.MAX_VALUE}, the value can be
-     * compactly stored in this field and used in computations.
-     */
-    private transient long intCompact;
-
-    // All 18-digit base ten strings fit into a long; not all 19-digit
-    // strings will
-    private static final int MAX_COMPACT_DIGITS = 18;
-
-    private static final int MAX_BIGINT_BITS = 62;
-
-    /* Appease the serialization gods */
-    private static final long serialVersionUID = 6108874887143696463L;
-
-    private static final ThreadLocal<StringBuilderHelper>
-        threadLocalStringBuilderHelper = new ThreadLocal<StringBuilderHelper>() {
-        @Override
-        protected StringBuilderHelper initialValue() {
-            return new StringBuilderHelper();
-        }
-    };
-
-    // Cache of common small BigDecimal values.
-    private static final BigDecimal zeroThroughTen[] = {
-        new BigDecimal(BigInteger.ZERO,         0,  0, 1),
-        new BigDecimal(BigInteger.ONE,          1,  0, 1),
-        new BigDecimal(BigInteger.valueOf(2),   2,  0, 1),
-        new BigDecimal(BigInteger.valueOf(3),   3,  0, 1),
-        new BigDecimal(BigInteger.valueOf(4),   4,  0, 1),
-        new BigDecimal(BigInteger.valueOf(5),   5,  0, 1),
-        new BigDecimal(BigInteger.valueOf(6),   6,  0, 1),
-        new BigDecimal(BigInteger.valueOf(7),   7,  0, 1),
-        new BigDecimal(BigInteger.valueOf(8),   8,  0, 1),
-        new BigDecimal(BigInteger.valueOf(9),   9,  0, 1),
-        new BigDecimal(BigInteger.TEN,          10, 0, 2),
-    };
-
-    // Cache of zero scaled by 0 - 15
-    private static final BigDecimal[] ZERO_SCALED_BY = {
-        zeroThroughTen[0],
-        new BigDecimal(BigInteger.ZERO, 0, 1, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 2, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 3, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 4, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 5, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 6, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 7, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 8, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 9, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 10, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 11, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 12, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 13, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 14, 1),
-        new BigDecimal(BigInteger.ZERO, 0, 15, 1),
-    };
-
-    // Half of Long.MIN_VALUE & Long.MAX_VALUE.
-    private static final long HALF_LONG_MAX_VALUE = Long.MAX_VALUE / 2;
-    private static final long HALF_LONG_MIN_VALUE = Long.MIN_VALUE / 2;
-
-    // Constants
-    /**
-     * The value 0, with a scale of 0.
-     *
-     * @since  1.5
-     */
-    public static final BigDecimal ZERO =
-        zeroThroughTen[0];
-
-    /**
-     * The value 1, with a scale of 0.
-     *
-     * @since  1.5
-     */
-    public static final BigDecimal ONE =
-        zeroThroughTen[1];
-
-    /**
-     * The value 10, with a scale of 0.
-     *
-     * @since  1.5
-     */
-    public static final BigDecimal TEN =
-        zeroThroughTen[10];
-
-    // Constructors
-
-    /**
-     * Trusted package private constructor.
-     * Trusted simply means if val is INFLATED, intVal could not be null and
-     * if intVal is null, val could not be INFLATED.
-     */
-    BigDecimal(BigInteger intVal, long val, int scale, int prec) {
-        this.scale = scale;
-        this.precision = prec;
-        this.intCompact = val;
-        this.intVal = intVal;
-    }
-
-    /**
-     * Translates a character array representation of a
-     * {@code BigDecimal} into a {@code BigDecimal}, accepting the
-     * same sequence of characters as the {@link #BigDecimal(String)}
-     * constructor, while allowing a sub-array to be specified.
-     *
-     * <p>Note that if the sequence of characters is already available
-     * within a character array, using this constructor is faster than
-     * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
-     *
-     * @param  in {@code char} array that is the source of characters.
-     * @param  offset first character in the array to inspect.
-     * @param  len number of characters to consider.
-     * @throws NumberFormatException if {@code in} is not a valid
-     *         representation of a {@code BigDecimal} or the defined subarray
-     *         is not wholly within {@code in}.
-     * @since  1.5
-     */
-    public BigDecimal(char[] in, int offset, int len) {
-        // protect against huge length.
-        if (offset+len > in.length || offset < 0)
-            throw new NumberFormatException();
-        // This is the primary string to BigDecimal constructor; all
-        // incoming strings end up here; it uses explicit (inline)
-        // parsing for speed and generates at most one intermediate
-        // (temporary) object (a char[] array) for non-compact case.
-
-        // Use locals for all fields values until completion
-        int prec = 0;                 // record precision value
-        int scl = 0;                  // record scale value
-        long rs = 0;                  // the compact value in long
-        BigInteger rb = null;         // the inflated value in BigInteger
-
-        // use array bounds checking to handle too-long, len == 0,
-        // bad offset, etc.
-        try {
-            // handle the sign
-            boolean isneg = false;          // assume positive
-            if (in[offset] == '-') {
-                isneg = true;               // leading minus means negative
-                offset++;
-                len--;
-            } else if (in[offset] == '+') { // leading + allowed
-                offset++;
-                len--;
-            }
-
-            // should now be at numeric part of the significand
-            boolean dot = false;             // true when there is a '.'
-            int cfirst = offset;             // record start of integer
-            long exp = 0;                    // exponent
-            char c;                          // current character
-
-            boolean isCompact = (len <= MAX_COMPACT_DIGITS);
-            // integer significand array & idx is the index to it. The array
-            // is ONLY used when we can't use a compact representation.
-            char coeff[] = isCompact ? null : new char[len];
-            int idx = 0;
-
-            for (; len > 0; offset++, len--) {
-                c = in[offset];
-                // have digit
-                if ((c >= '0' && c <= '9') || Character.isDigit(c)) {
-                    // First compact case, we need not to preserve the character
-                    // and we can just compute the value in place.
-                    if (isCompact) {
-                        int digit = Character.digit(c, 10);
-                        if (digit == 0) {
-                            if (prec == 0)
-                                prec = 1;
-                            else if (rs != 0) {
-                                rs *= 10;
-                                ++prec;
-                            } // else digit is a redundant leading zero
-                        } else {
-                            if (prec != 1 || rs != 0)
-                                ++prec; // prec unchanged if preceded by 0s
-                            rs = rs * 10 + digit;
-                        }
-                    } else { // the unscaled value is likely a BigInteger object.
-                        if (c == '0' || Character.digit(c, 10) == 0) {
-                            if (prec == 0) {
-                                coeff[idx] = c;
-                                prec = 1;
-                            } else if (idx != 0) {
-                                coeff[idx++] = c;
-                                ++prec;
-                            } // else c must be a redundant leading zero
-                        } else {
-                            if (prec != 1 || idx != 0)
-                                ++prec; // prec unchanged if preceded by 0s
-                            coeff[idx++] = c;
-                        }
-                    }
-                    if (dot)
-                        ++scl;
-                    continue;
-                }
-                // have dot
-                if (c == '.') {
-                    // have dot
-                    if (dot)         // two dots
-                        throw new NumberFormatException();
-                    dot = true;
-                    continue;
-                }
-                // exponent expected
-                if ((c != 'e') && (c != 'E'))
-                    throw new NumberFormatException();
-                offset++;
-                c = in[offset];
-                len--;
-                boolean negexp = (c == '-');
-                // optional sign
-                if (negexp || c == '+') {
-                    offset++;
-                    c = in[offset];
-                    len--;
-                }
-                if (len <= 0)    // no exponent digits
-                    throw new NumberFormatException();
-                // skip leading zeros in the exponent
-                while (len > 10 && Character.digit(c, 10) == 0) {
-                    offset++;
-                    c = in[offset];
-                    len--;
-                }
-                if (len > 10)  // too many nonzero exponent digits
-                    throw new NumberFormatException();
-                // c now holds first digit of exponent
-                for (;; len--) {
-                    int v;
-                    if (c >= '0' && c <= '9') {
-                        v = c - '0';
-                    } else {
-                        v = Character.digit(c, 10);
-                        if (v < 0)            // not a digit
-                            throw new NumberFormatException();
-                    }
-                    exp = exp * 10 + v;
-                    if (len == 1)
-                        break;               // that was final character
-                    offset++;
-                    c = in[offset];
-                }
-                if (negexp)                  // apply sign
-                    exp = -exp;
-                // Next test is required for backwards compatibility
-                if ((int)exp != exp)         // overflow
-                    throw new NumberFormatException();
-                break;                       // [saves a test]
-            }
-            // here when no characters left
-            if (prec == 0)              // no digits found
-                throw new NumberFormatException();
-
-            // Adjust scale if exp is not zero.
-            if (exp != 0) {                  // had significant exponent
-                // Can't call checkScale which relies on proper fields value
-                long adjustedScale = scl - exp;
-                if (adjustedScale > Integer.MAX_VALUE ||
-                    adjustedScale < Integer.MIN_VALUE)
-                    throw new NumberFormatException("Scale out of range.");
-                scl = (int)adjustedScale;
-            }
-
-            // Remove leading zeros from precision (digits count)
-            if (isCompact) {
-                rs = isneg ? -rs : rs;
-            } else {
-                char quick[];
-                if (!isneg) {
-                    quick = (coeff.length != prec) ?
-                        Arrays.copyOf(coeff, prec) : coeff;
-                } else {
-                    quick = new char[prec + 1];
-                    quick[0] = '-';
-                    System.arraycopy(coeff, 0, quick, 1, prec);
-                }
-                rb = new BigInteger(quick);
-                rs = compactValFor(rb);
-            }
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new NumberFormatException();
-        } catch (NegativeArraySizeException e) {
-            throw new NumberFormatException();
-        }
-        this.scale = scl;
-        this.precision = prec;
-        this.intCompact = rs;
-        this.intVal = (rs != INFLATED) ? null : rb;
-    }
-
-    /**
-     * Translates a character array representation of a
-     * {@code BigDecimal} into a {@code BigDecimal}, accepting the
-     * same sequence of characters as the {@link #BigDecimal(String)}
-     * constructor, while allowing a sub-array to be specified and
-     * with rounding according to the context settings.
-     *
-     * <p>Note that if the sequence of characters is already available
-     * within a character array, using this constructor is faster than
-     * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
-     *
-     * @param  in {@code char} array that is the source of characters.
-     * @param  offset first character in the array to inspect.
-     * @param  len number of characters to consider..
-     * @param  mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @throws NumberFormatException if {@code in} is not a valid
-     *         representation of a {@code BigDecimal} or the defined subarray
-     *         is not wholly within {@code in}.
-     * @since  1.5
-     */
-    public BigDecimal(char[] in, int offset, int len, MathContext mc) {
-        this(in, offset, len);
-        if (mc.precision > 0)
-            roundThis(mc);
-    }
-
-    /**
-     * Translates a character array representation of a
-     * {@code BigDecimal} into a {@code BigDecimal}, accepting the
-     * same sequence of characters as the {@link #BigDecimal(String)}
-     * constructor.
-     *
-     * <p>Note that if the sequence of characters is already available
-     * as a character array, using this constructor is faster than
-     * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
-     *
-     * @param in {@code char} array that is the source of characters.
-     * @throws NumberFormatException if {@code in} is not a valid
-     *         representation of a {@code BigDecimal}.
-     * @since  1.5
-     */
-    public BigDecimal(char[] in) {
-        this(in, 0, in.length);
-    }
-
-    /**
-     * Translates a character array representation of a
-     * {@code BigDecimal} into a {@code BigDecimal}, accepting the
-     * same sequence of characters as the {@link #BigDecimal(String)}
-     * constructor and with rounding according to the context
-     * settings.
-     *
-     * <p>Note that if the sequence of characters is already available
-     * as a character array, using this constructor is faster than
-     * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
-     *
-     * @param  in {@code char} array that is the source of characters.
-     * @param  mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @throws NumberFormatException if {@code in} is not a valid
-     *         representation of a {@code BigDecimal}.
-     * @since  1.5
-     */
-    public BigDecimal(char[] in, MathContext mc) {
-        this(in, 0, in.length, mc);
-    }
-
-    /**
-     * Translates the string representation of a {@code BigDecimal}
-     * into a {@code BigDecimal}.  The string representation consists
-     * of an optional sign, {@code '+'} (<tt> '&#92;u002B'</tt>) or
-     * {@code '-'} (<tt>'&#92;u002D'</tt>), followed by a sequence of
-     * zero or more decimal digits ("the integer"), optionally
-     * followed by a fraction, optionally followed by an exponent.
-     *
-     * <p>The fraction consists of a decimal point followed by zero
-     * or more decimal digits.  The string must contain at least one
-     * digit in either the integer or the fraction.  The number formed
-     * by the sign, the integer and the fraction is referred to as the
-     * <i>significand</i>.
-     *
-     * <p>The exponent consists of the character {@code 'e'}
-     * (<tt>'&#92;u0065'</tt>) or {@code 'E'} (<tt>'&#92;u0045'</tt>)
-     * followed by one or more decimal digits.  The value of the
-     * exponent must lie between -{@link Integer#MAX_VALUE} ({@link
-     * Integer#MIN_VALUE}+1) and {@link Integer#MAX_VALUE}, inclusive.
-     *
-     * <p>More formally, the strings this constructor accepts are
-     * described by the following grammar:
-     * <blockquote>
-     * <dl>
-     * <dt><i>BigDecimalString:</i>
-     * <dd><i>Sign<sub>opt</sub> Significand Exponent<sub>opt</sub></i>
-     * <p>
-     * <dt><i>Sign:</i>
-     * <dd>{@code +}
-     * <dd>{@code -}
-     * <p>
-     * <dt><i>Significand:</i>
-     * <dd><i>IntegerPart</i> {@code .} <i>FractionPart<sub>opt</sub></i>
-     * <dd>{@code .} <i>FractionPart</i>
-     * <dd><i>IntegerPart</i>
-     * <p>
-     * <dt><i>IntegerPart:</i>
-     * <dd><i>Digits</i>
-     * <p>
-     * <dt><i>FractionPart:</i>
-     * <dd><i>Digits</i>
-     * <p>
-     * <dt><i>Exponent:</i>
-     * <dd><i>ExponentIndicator SignedInteger</i>
-     * <p>
-     * <dt><i>ExponentIndicator:</i>
-     * <dd>{@code e}
-     * <dd>{@code E}
-     * <p>
-     * <dt><i>SignedInteger:</i>
-     * <dd><i>Sign<sub>opt</sub> Digits</i>
-     * <p>
-     * <dt><i>Digits:</i>
-     * <dd><i>Digit</i>
-     * <dd><i>Digits Digit</i>
-     * <p>
-     * <dt><i>Digit:</i>
-     * <dd>any character for which {@link Character#isDigit}
-     * returns {@code true}, including 0, 1, 2 ...
-     * </dl>
-     * </blockquote>
-     *
-     * <p>The scale of the returned {@code BigDecimal} will be the
-     * number of digits in the fraction, or zero if the string
-     * contains no decimal point, subject to adjustment for any
-     * exponent; if the string contains an exponent, the exponent is
-     * subtracted from the scale.  The value of the resulting scale
-     * must lie between {@code Integer.MIN_VALUE} and
-     * {@code Integer.MAX_VALUE}, inclusive.
-     *
-     * <p>The character-to-digit mapping is provided by {@link
-     * java.lang.Character#digit} set to convert to radix 10.  The
-     * String may not contain any extraneous characters (whitespace,
-     * for example).
-     *
-     * <p><b>Examples:</b><br>
-     * The value of the returned {@code BigDecimal} is equal to
-     * <i>significand</i> &times; 10<sup>&nbsp;<i>exponent</i></sup>.
-     * For each string on the left, the resulting representation
-     * [{@code BigInteger}, {@code scale}] is shown on the right.
-     * <pre>
-     * "0"            [0,0]
-     * "0.00"         [0,2]
-     * "123"          [123,0]
-     * "-123"         [-123,0]
-     * "1.23E3"       [123,-1]
-     * "1.23E+3"      [123,-1]
-     * "12.3E+7"      [123,-6]
-     * "12.0"         [120,1]
-     * "12.3"         [123,1]
-     * "0.00123"      [123,5]
-     * "-1.23E-12"    [-123,14]
-     * "1234.5E-4"    [12345,5]
-     * "0E+7"         [0,-7]
-     * "-0"           [0,0]
-     * </pre>
-     *
-     * <p>Note: For values other than {@code float} and
-     * {@code double} NaN and &plusmn;Infinity, this constructor is
-     * compatible with the values returned by {@link Float#toString}
-     * and {@link Double#toString}.  This is generally the preferred
-     * way to convert a {@code float} or {@code double} into a
-     * BigDecimal, as it doesn't suffer from the unpredictability of
-     * the {@link #BigDecimal(double)} constructor.
-     *
-     * @param val String representation of {@code BigDecimal}.
-     *
-     * @throws NumberFormatException if {@code val} is not a valid
-     *         representation of a {@code BigDecimal}.
-     */
-    public BigDecimal(String val) {
-        this(val.toCharArray(), 0, val.length());
-    }
-
-    /**
-     * Translates the string representation of a {@code BigDecimal}
-     * into a {@code BigDecimal}, accepting the same strings as the
-     * {@link #BigDecimal(String)} constructor, with rounding
-     * according to the context settings.
-     *
-     * @param  val string representation of a {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @throws NumberFormatException if {@code val} is not a valid
-     *         representation of a BigDecimal.
-     * @since  1.5
-     */
-    public BigDecimal(String val, MathContext mc) {
-        this(val.toCharArray(), 0, val.length());
-        if (mc.precision > 0)
-            roundThis(mc);
-    }
-
-    /**
-     * Translates a {@code double} into a {@code BigDecimal} which
-     * is the exact decimal representation of the {@code double}'s
-     * binary floating-point value.  The scale of the returned
-     * {@code BigDecimal} is the smallest value such that
-     * <tt>(10<sup>scale</sup> &times; val)</tt> is an integer.
-     * <p>
-     * <b>Notes:</b>
-     * <ol>
-     * <li>
-     * The results of this constructor can be somewhat unpredictable.
-     * One might assume that writing {@code new BigDecimal(0.1)} in
-     * Java creates a {@code BigDecimal} which is exactly equal to
-     * 0.1 (an unscaled value of 1, with a scale of 1), but it is
-     * actually equal to
-     * 0.1000000000000000055511151231257827021181583404541015625.
-     * This is because 0.1 cannot be represented exactly as a
-     * {@code double} (or, for that matter, as a binary fraction of
-     * any finite length).  Thus, the value that is being passed
-     * <i>in</i> to the constructor is not exactly equal to 0.1,
-     * appearances notwithstanding.
-     *
-     * <li>
-     * The {@code String} constructor, on the other hand, is
-     * perfectly predictable: writing {@code new BigDecimal("0.1")}
-     * creates a {@code BigDecimal} which is <i>exactly</i> equal to
-     * 0.1, as one would expect.  Therefore, it is generally
-     * recommended that the {@linkplain #BigDecimal(String)
-     * <tt>String</tt> constructor} be used in preference to this one.
-     *
-     * <li>
-     * When a {@code double} must be used as a source for a
-     * {@code BigDecimal}, note that this constructor provides an
-     * exact conversion; it does not give the same result as
-     * converting the {@code double} to a {@code String} using the
-     * {@link Double#toString(double)} method and then using the
-     * {@link #BigDecimal(String)} constructor.  To get that result,
-     * use the {@code static} {@link #valueOf(double)} method.
-     * </ol>
-     *
-     * @param val {@code double} value to be converted to
-     *        {@code BigDecimal}.
-     * @throws NumberFormatException if {@code val} is infinite or NaN.
-     */
-    public BigDecimal(double val) {
-        if (Double.isInfinite(val) || Double.isNaN(val))
-            throw new NumberFormatException("Infinite or NaN");
-
-        // Translate the double into sign, exponent and significand, according
-        // to the formulae in JLS, Section 20.10.22.
-        long valBits = Double.doubleToLongBits(val);
-        int sign = ((valBits >> 63)==0 ? 1 : -1);
-        int exponent = (int) ((valBits >> 52) & 0x7ffL);
-        long significand = (exponent==0 ? (valBits & ((1L<<52) - 1)) << 1
-                            : (valBits & ((1L<<52) - 1)) | (1L<<52));
-        exponent -= 1075;
-        // At this point, val == sign * significand * 2**exponent.
-
-        /*
-         * Special case zero to supress nonterminating normalization
-         * and bogus scale calculation.
-         */
-        if (significand == 0) {
-            intVal = BigInteger.ZERO;
-            intCompact = 0;
-            precision = 1;
-            return;
-        }
-
-        // Normalize
-        while((significand & 1) == 0) {    //  i.e., significand is even
-            significand >>= 1;
-            exponent++;
-        }
-
-        // Calculate intVal and scale
-        long s = sign * significand;
-        BigInteger b;
-        if (exponent < 0) {
-            b = BigInteger.valueOf(5).pow(-exponent).multiply(s);
-            scale = -exponent;
-        } else if (exponent > 0) {
-            b = BigInteger.valueOf(2).pow(exponent).multiply(s);
-        } else {
-            b = BigInteger.valueOf(s);
-        }
-        intCompact = compactValFor(b);
-        intVal = (intCompact != INFLATED) ? null : b;
-    }
-
-    /**
-     * Translates a {@code double} into a {@code BigDecimal}, with
-     * rounding according to the context settings.  The scale of the
-     * {@code BigDecimal} is the smallest value such that
-     * <tt>(10<sup>scale</sup> &times; val)</tt> is an integer.
-     *
-     * <p>The results of this constructor can be somewhat unpredictable
-     * and its use is generally not recommended; see the notes under
-     * the {@link #BigDecimal(double)} constructor.
-     *
-     * @param  val {@code double} value to be converted to
-     *         {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         RoundingMode is UNNECESSARY.
-     * @throws NumberFormatException if {@code val} is infinite or NaN.
-     * @since  1.5
-     */
-    public BigDecimal(double val, MathContext mc) {
-        this(val);
-        if (mc.precision > 0)
-            roundThis(mc);
-    }
-
-    /**
-     * Translates a {@code BigInteger} into a {@code BigDecimal}.
-     * The scale of the {@code BigDecimal} is zero.
-     *
-     * @param val {@code BigInteger} value to be converted to
-     *            {@code BigDecimal}.
-     */
-    public BigDecimal(BigInteger val) {
-        intCompact = compactValFor(val);
-        intVal = (intCompact != INFLATED) ? null : val;
-    }
-
-    /**
-     * Translates a {@code BigInteger} into a {@code BigDecimal}
-     * rounding according to the context settings.  The scale of the
-     * {@code BigDecimal} is zero.
-     *
-     * @param val {@code BigInteger} value to be converted to
-     *            {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since  1.5
-     */
-    public BigDecimal(BigInteger val, MathContext mc) {
-        this(val);
-        if (mc.precision > 0)
-            roundThis(mc);
-    }
-
-    /**
-     * Translates a {@code BigInteger} unscaled value and an
-     * {@code int} scale into a {@code BigDecimal}.  The value of
-     * the {@code BigDecimal} is
-     * <tt>(unscaledVal &times; 10<sup>-scale</sup>)</tt>.
-     *
-     * @param unscaledVal unscaled value of the {@code BigDecimal}.
-     * @param scale scale of the {@code BigDecimal}.
-     */
-    public BigDecimal(BigInteger unscaledVal, int scale) {
-        // Negative scales are now allowed
-        this(unscaledVal);
-        this.scale = scale;
-    }
-
-    /**
-     * Translates a {@code BigInteger} unscaled value and an
-     * {@code int} scale into a {@code BigDecimal}, with rounding
-     * according to the context settings.  The value of the
-     * {@code BigDecimal} is <tt>(unscaledVal &times;
-     * 10<sup>-scale</sup>)</tt>, rounded according to the
-     * {@code precision} and rounding mode settings.
-     *
-     * @param  unscaledVal unscaled value of the {@code BigDecimal}.
-     * @param  scale scale of the {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since  1.5
-     */
-    public BigDecimal(BigInteger unscaledVal, int scale, MathContext mc) {
-        this(unscaledVal);
-        this.scale = scale;
-        if (mc.precision > 0)
-            roundThis(mc);
-    }
-
-    /**
-     * Translates an {@code int} into a {@code BigDecimal}.  The
-     * scale of the {@code BigDecimal} is zero.
-     *
-     * @param val {@code int} value to be converted to
-     *            {@code BigDecimal}.
-     * @since  1.5
-     */
-    public BigDecimal(int val) {
-        intCompact = val;
-    }
-
-    /**
-     * Translates an {@code int} into a {@code BigDecimal}, with
-     * rounding according to the context settings.  The scale of the
-     * {@code BigDecimal}, before any rounding, is zero.
-     *
-     * @param  val {@code int} value to be converted to {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since  1.5
-     */
-    public BigDecimal(int val, MathContext mc) {
-        intCompact = val;
-        if (mc.precision > 0)
-            roundThis(mc);
-    }
-
-    /**
-     * Translates a {@code long} into a {@code BigDecimal}.  The
-     * scale of the {@code BigDecimal} is zero.
-     *
-     * @param val {@code long} value to be converted to {@code BigDecimal}.
-     * @since  1.5
-     */
-    public BigDecimal(long val) {
-        this.intCompact = val;
-        this.intVal = (val == INFLATED) ? BigInteger.valueOf(val) : null;
-    }
-
-    /**
-     * Translates a {@code long} into a {@code BigDecimal}, with
-     * rounding according to the context settings.  The scale of the
-     * {@code BigDecimal}, before any rounding, is zero.
-     *
-     * @param  val {@code long} value to be converted to {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since  1.5
-     */
-    public BigDecimal(long val, MathContext mc) {
-        this(val);
-        if (mc.precision > 0)
-            roundThis(mc);
-    }
-
-    // Static Factory Methods
-
-    /**
-     * Translates a {@code long} unscaled value and an
-     * {@code int} scale into a {@code BigDecimal}.  This
-     * {@literal "static factory method"} is provided in preference to
-     * a ({@code long}, {@code int}) constructor because it
-     * allows for reuse of frequently used {@code BigDecimal} values..
-     *
-     * @param unscaledVal unscaled value of the {@code BigDecimal}.
-     * @param scale scale of the {@code BigDecimal}.
-     * @return a {@code BigDecimal} whose value is
-     *         <tt>(unscaledVal &times; 10<sup>-scale</sup>)</tt>.
-     */
-    public static BigDecimal valueOf(long unscaledVal, int scale) {
-        if (scale == 0)
-            return valueOf(unscaledVal);
-        else if (unscaledVal == 0) {
-            if (scale > 0 && scale < ZERO_SCALED_BY.length)
-                return ZERO_SCALED_BY[scale];
-            else
-                return new BigDecimal(BigInteger.ZERO, 0, scale, 1);
-        }
-        return new BigDecimal(unscaledVal == INFLATED ?
-                              BigInteger.valueOf(unscaledVal) : null,
-                              unscaledVal, scale, 0);
-    }
-
-    /**
-     * Translates a {@code long} value into a {@code BigDecimal}
-     * with a scale of zero.  This {@literal "static factory method"}
-     * is provided in preference to a ({@code long}) constructor
-     * because it allows for reuse of frequently used
-     * {@code BigDecimal} values.
-     *
-     * @param val value of the {@code BigDecimal}.
-     * @return a {@code BigDecimal} whose value is {@code val}.
-     */
-    public static BigDecimal valueOf(long val) {
-        if (val >= 0 && val < zeroThroughTen.length)
-            return zeroThroughTen[(int)val];
-        else if (val != INFLATED)
-            return new BigDecimal(null, val, 0, 0);
-        return new BigDecimal(BigInteger.valueOf(val), val, 0, 0);
-    }
-
-    /**
-     * Translates a {@code double} into a {@code BigDecimal}, using
-     * the {@code double}'s canonical string representation provided
-     * by the {@link Double#toString(double)} method.
-     *
-     * <p><b>Note:</b> This is generally the preferred way to convert
-     * a {@code double} (or {@code float}) into a
-     * {@code BigDecimal}, as the value returned is equal to that
-     * resulting from constructing a {@code BigDecimal} from the
-     * result of using {@link Double#toString(double)}.
-     *
-     * @param  val {@code double} to convert to a {@code BigDecimal}.
-     * @return a {@code BigDecimal} whose value is equal to or approximately
-     *         equal to the value of {@code val}.
-     * @throws NumberFormatException if {@code val} is infinite or NaN.
-     * @since  1.5
-     */
-    public static BigDecimal valueOf(double val) {
-        // Reminder: a zero double returns '0.0', so we cannot fastpath
-        // to use the constant ZERO.  This might be important enough to
-        // justify a factory approach, a cache, or a few private
-        // constants, later.
-        return new BigDecimal(Double.toString(val));
-    }
-
-    // Arithmetic Operations
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this +
-     * augend)}, and whose scale is {@code max(this.scale(),
-     * augend.scale())}.
-     *
-     * @param  augend value to be added to this {@code BigDecimal}.
-     * @return {@code this + augend}
-     */
-    public BigDecimal add(BigDecimal augend) {
-        long xs = this.intCompact;
-        long ys = augend.intCompact;
-        BigInteger fst = (xs != INFLATED) ? null : this.intVal;
-        BigInteger snd = (ys != INFLATED) ? null : augend.intVal;
-        int rscale = this.scale;
-
-        long sdiff = (long)rscale - augend.scale;
-        if (sdiff != 0) {
-            if (sdiff < 0) {
-                int raise = checkScale(-sdiff);
-                rscale = augend.scale;
-                if (xs == INFLATED ||
-                    (xs = longMultiplyPowerTen(xs, raise)) == INFLATED)
-                    fst = bigMultiplyPowerTen(raise);
-            } else {
-                int raise = augend.checkScale(sdiff);
-                if (ys == INFLATED ||
-                    (ys = longMultiplyPowerTen(ys, raise)) == INFLATED)
-                    snd = augend.bigMultiplyPowerTen(raise);
-            }
-        }
-        if (xs != INFLATED && ys != INFLATED) {
-            long sum = xs + ys;
-            // See "Hacker's Delight" section 2-12 for explanation of
-            // the overflow test.
-            if ( (((sum ^ xs) & (sum ^ ys))) >= 0L) // not overflowed
-                return BigDecimal.valueOf(sum, rscale);
-        }
-        if (fst == null)
-            fst = BigInteger.valueOf(xs);
-        if (snd == null)
-            snd = BigInteger.valueOf(ys);
-        BigInteger sum = fst.add(snd);
-        return (fst.signum == snd.signum) ?
-            new BigDecimal(sum, INFLATED, rscale, 0) :
-            new BigDecimal(sum, rscale);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this + augend)},
-     * with rounding according to the context settings.
-     *
-     * If either number is zero and the precision setting is nonzero then
-     * the other number, rounded if necessary, is used as the result.
-     *
-     * @param  augend value to be added to this {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @return {@code this + augend}, rounded as necessary.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since  1.5
-     */
-    public BigDecimal add(BigDecimal augend, MathContext mc) {
-        if (mc.precision == 0)
-            return add(augend);
-        BigDecimal lhs = this;
-
-        // Could optimize if values are compact
-        this.inflate();
-        augend.inflate();
-
-        // If either number is zero then the other number, rounded and
-        // scaled if necessary, is used as the result.
-        {
-            boolean lhsIsZero = lhs.signum() == 0;
-            boolean augendIsZero = augend.signum() == 0;
-
-            if (lhsIsZero || augendIsZero) {
-                int preferredScale = Math.max(lhs.scale(), augend.scale());
-                BigDecimal result;
-
-                // Could use a factory for zero instead of a new object
-                if (lhsIsZero && augendIsZero)
-                    return new BigDecimal(BigInteger.ZERO, 0, preferredScale, 0);
-
-                result = lhsIsZero ? doRound(augend, mc) : doRound(lhs, mc);
-
-                if (result.scale() == preferredScale)
-                    return result;
-                else if (result.scale() > preferredScale) {
-                    BigDecimal scaledResult =
-                        new BigDecimal(result.intVal, result.intCompact,
-                                       result.scale, 0);
-                    scaledResult.stripZerosToMatchScale(preferredScale);
-                    return scaledResult;
-                } else { // result.scale < preferredScale
-                    int precisionDiff = mc.precision - result.precision();
-                    int scaleDiff     = preferredScale - result.scale();
-
-                    if (precisionDiff >= scaleDiff)
-                        return result.setScale(preferredScale); // can achieve target scale
-                    else
-                        return result.setScale(result.scale() + precisionDiff);
-                }
-            }
-        }
-
-        long padding = (long)lhs.scale - augend.scale;
-        if (padding != 0) {        // scales differ; alignment needed
-            BigDecimal arg[] = preAlign(lhs, augend, padding, mc);
-            matchScale(arg);
-            lhs    = arg[0];
-            augend = arg[1];
-        }
-
-        BigDecimal d = new BigDecimal(lhs.inflate().add(augend.inflate()),
-                                      lhs.scale);
-        return doRound(d, mc);
-    }
-
-    /**
-     * Returns an array of length two, the sum of whose entries is
-     * equal to the rounded sum of the {@code BigDecimal} arguments.
-     *
-     * <p>If the digit positions of the arguments have a sufficient
-     * gap between them, the value smaller in magnitude can be
-     * condensed into a {@literal "sticky bit"} and the end result will
-     * round the same way <em>if</em> the precision of the final
-     * result does not include the high order digit of the small
-     * magnitude operand.
-     *
-     * <p>Note that while strictly speaking this is an optimization,
-     * it makes a much wider range of additions practical.
-     *
-     * <p>This corresponds to a pre-shift operation in a fixed
-     * precision floating-point adder; this method is complicated by
-     * variable precision of the result as determined by the
-     * MathContext.  A more nuanced operation could implement a
-     * {@literal "right shift"} on the smaller magnitude operand so
-     * that the number of digits of the smaller operand could be
-     * reduced even though the significands partially overlapped.
-     */
-    private BigDecimal[] preAlign(BigDecimal lhs, BigDecimal augend,
-                                  long padding, MathContext mc) {
-        assert padding != 0;
-        BigDecimal big;
-        BigDecimal small;
-
-        if (padding < 0) {     // lhs is big;   augend is small
-            big   = lhs;
-            small = augend;
-        } else {               // lhs is small; augend is big
-            big   = augend;
-            small = lhs;
-        }
-
-        /*
-         * This is the estimated scale of an ulp of the result; it
-         * assumes that the result doesn't have a carry-out on a true
-         * add (e.g. 999 + 1 => 1000) or any subtractive cancellation
-         * on borrowing (e.g. 100 - 1.2 => 98.8)
-         */
-        long estResultUlpScale = (long)big.scale - big.precision() + mc.precision;
-
-        /*
-         * The low-order digit position of big is big.scale().  This
-         * is true regardless of whether big has a positive or
-         * negative scale.  The high-order digit position of small is
-         * small.scale - (small.precision() - 1).  To do the full
-         * condensation, the digit positions of big and small must be
-         * disjoint *and* the digit positions of small should not be
-         * directly visible in the result.
-         */
-        long smallHighDigitPos = (long)small.scale - small.precision() + 1;
-        if (smallHighDigitPos > big.scale + 2 &&         // big and small disjoint
-            smallHighDigitPos > estResultUlpScale + 2) { // small digits not visible
-            small = BigDecimal.valueOf(small.signum(),
-                                       this.checkScale(Math.max(big.scale, estResultUlpScale) + 3));
-        }
-
-        // Since addition is symmetric, preserving input order in
-        // returned operands doesn't matter
-        BigDecimal[] result = {big, small};
-        return result;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this -
-     * subtrahend)}, and whose scale is {@code max(this.scale(),
-     * subtrahend.scale())}.
-     *
-     * @param  subtrahend value to be subtracted from this {@code BigDecimal}.
-     * @return {@code this - subtrahend}
-     */
-    public BigDecimal subtract(BigDecimal subtrahend) {
-        return add(subtrahend.negate());
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this - subtrahend)},
-     * with rounding according to the context settings.
-     *
-     * If {@code subtrahend} is zero then this, rounded if necessary, is used as the
-     * result.  If this is zero then the result is {@code subtrahend.negate(mc)}.
-     *
-     * @param  subtrahend value to be subtracted from this {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @return {@code this - subtrahend}, rounded as necessary.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since  1.5
-     */
-    public BigDecimal subtract(BigDecimal subtrahend, MathContext mc) {
-        BigDecimal nsubtrahend = subtrahend.negate();
-        if (mc.precision == 0)
-            return add(nsubtrahend);
-        // share the special rounding code in add()
-        return add(nsubtrahend, mc);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is <tt>(this &times;
-     * multiplicand)</tt>, and whose scale is {@code (this.scale() +
-     * multiplicand.scale())}.
-     *
-     * @param  multiplicand value to be multiplied by this {@code BigDecimal}.
-     * @return {@code this * multiplicand}
-     */
-    public BigDecimal multiply(BigDecimal multiplicand) {
-        long x = this.intCompact;
-        long y = multiplicand.intCompact;
-        int productScale = checkScale((long)scale + multiplicand.scale);
-
-        // Might be able to do a more clever check incorporating the
-        // inflated check into the overflow computation.
-        if (x != INFLATED && y != INFLATED) {
-            /*
-             * If the product is not an overflowed value, continue
-             * to use the compact representation.  if either of x or y
-             * is INFLATED, the product should also be regarded as
-             * an overflow. Before using the overflow test suggested in
-             * "Hacker's Delight" section 2-12, we perform quick checks
-             * using the precision information to see whether the overflow
-             * would occur since division is expensive on most CPUs.
-             */
-            long product = x * y;
-            long prec = this.precision() + multiplicand.precision();
-            if (prec < 19 || (prec < 21 && (y == 0 || product / y == x)))
-                return BigDecimal.valueOf(product, productScale);
-            return new BigDecimal(BigInteger.valueOf(x).multiply(y), INFLATED,
-                                  productScale, 0);
-        }
-        BigInteger rb;
-        if (x == INFLATED && y == INFLATED)
-            rb = this.intVal.multiply(multiplicand.intVal);
-        else if (x != INFLATED)
-            rb = multiplicand.intVal.multiply(x);
-        else
-            rb = this.intVal.multiply(y);
-        return new BigDecimal(rb, INFLATED, productScale, 0);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is <tt>(this &times;
-     * multiplicand)</tt>, with rounding according to the context settings.
-     *
-     * @param  multiplicand value to be multiplied by this {@code BigDecimal}.
-     * @param  mc the context to use.
-     * @return {@code this * multiplicand}, rounded as necessary.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since  1.5
-     */
-    public BigDecimal multiply(BigDecimal multiplicand, MathContext mc) {
-        if (mc.precision == 0)
-            return multiply(multiplicand);
-        return doRound(this.multiply(multiplicand), mc);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this /
-     * divisor)}, and whose scale is as specified.  If rounding must
-     * be performed to generate a result with the specified scale, the
-     * specified rounding mode is applied.
-     *
-     * <p>The new {@link #divide(BigDecimal, int, RoundingMode)} method
-     * should be used in preference to this legacy method.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @param  scale scale of the {@code BigDecimal} quotient to be returned.
-     * @param  roundingMode rounding mode to apply.
-     * @return {@code this / divisor}
-     * @throws ArithmeticException if {@code divisor} is zero,
-     *         {@code roundingMode==ROUND_UNNECESSARY} and
-     *         the specified scale is insufficient to represent the result
-     *         of the division exactly.
-     * @throws IllegalArgumentException if {@code roundingMode} does not
-     *         represent a valid rounding mode.
-     * @see    #ROUND_UP
-     * @see    #ROUND_DOWN
-     * @see    #ROUND_CEILING
-     * @see    #ROUND_FLOOR
-     * @see    #ROUND_HALF_UP
-     * @see    #ROUND_HALF_DOWN
-     * @see    #ROUND_HALF_EVEN
-     * @see    #ROUND_UNNECESSARY
-     */
-    public BigDecimal divide(BigDecimal divisor, int scale, int roundingMode) {
-        /*
-         * IMPLEMENTATION NOTE: This method *must* return a new object
-         * since divideAndRound uses divide to generate a value whose
-         * scale is then modified.
-         */
-        if (roundingMode < ROUND_UP || roundingMode > ROUND_UNNECESSARY)
-            throw new IllegalArgumentException("Invalid rounding mode");
-        /*
-         * Rescale dividend or divisor (whichever can be "upscaled" to
-         * produce correctly scaled quotient).
-         * Take care to detect out-of-range scales
-         */
-        BigDecimal dividend = this;
-        if (checkScale((long)scale + divisor.scale) > this.scale)
-            dividend = this.setScale(scale + divisor.scale, ROUND_UNNECESSARY);
-        else
-            divisor = divisor.setScale(checkScale((long)this.scale - scale),
-                                       ROUND_UNNECESSARY);
-        return divideAndRound(dividend.intCompact, dividend.intVal,
-                              divisor.intCompact, divisor.intVal,
-                              scale, roundingMode, scale);
-    }
-
-    /**
-     * Internally used for division operation. The dividend and divisor are
-     * passed both in {@code long} format and {@code BigInteger} format. The
-     * returned {@code BigDecimal} object is the quotient whose scale is set to
-     * the passed in scale. If the remainder is not zero, it will be rounded
-     * based on the passed in roundingMode. Also, if the remainder is zero and
-     * the last parameter, i.e. preferredScale is NOT equal to scale, the
-     * trailing zeros of the result is stripped to match the preferredScale.
-     */
-    private static BigDecimal divideAndRound(long ldividend, BigInteger bdividend,
-                                             long ldivisor,  BigInteger bdivisor,
-                                             int scale, int roundingMode,
-                                             int preferredScale) {
-        boolean isRemainderZero;       // record remainder is zero or not
-        int qsign;                     // quotient sign
-        long q = 0, r = 0;             // store quotient & remainder in long
-        MutableBigInteger mq = null;   // store quotient
-        MutableBigInteger mr = null;   // store remainder
-        MutableBigInteger mdivisor = null;
-        boolean isLongDivision = (ldividend != INFLATED && ldivisor != INFLATED);
-        if (isLongDivision) {
-            q = ldividend / ldivisor;
-            if (roundingMode == ROUND_DOWN && scale == preferredScale)
-                return new BigDecimal(null, q, scale, 0);
-            r = ldividend % ldivisor;
-            isRemainderZero = (r == 0);
-            qsign = ((ldividend < 0) == (ldivisor < 0)) ? 1 : -1;
-        } else {
-            if (bdividend == null)
-                bdividend = BigInteger.valueOf(ldividend);
-            // Descend into mutables for faster remainder checks
-            MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
-            mq = new MutableBigInteger();
-            if (ldivisor != INFLATED) {
-                r = mdividend.divide(ldivisor, mq);
-                isRemainderZero = (r == 0);
-                qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
-            } else {
-                mdivisor = new MutableBigInteger(bdivisor.mag);
-                mr = mdividend.divide(mdivisor, mq);
-                isRemainderZero = mr.isZero();
-                qsign = (bdividend.signum != bdivisor.signum) ? -1 : 1;
-            }
-        }
-        boolean increment = false;
-        if (!isRemainderZero) {
-            int cmpFracHalf;
-            /* Round as appropriate */
-            if (roundingMode == ROUND_UNNECESSARY) {  // Rounding prohibited
-                throw new ArithmeticException("Rounding necessary");
-            } else if (roundingMode == ROUND_UP) {      // Away from zero
-                increment = true;
-            } else if (roundingMode == ROUND_DOWN) {    // Towards zero
-                increment = false;
-            } else if (roundingMode == ROUND_CEILING) { // Towards +infinity
-                increment = (qsign > 0);
-            } else if (roundingMode == ROUND_FLOOR) {   // Towards -infinity
-                increment = (qsign < 0);
-            } else {
-                if (isLongDivision || ldivisor != INFLATED) {
-                    if (r <= HALF_LONG_MIN_VALUE || r > HALF_LONG_MAX_VALUE) {
-                        cmpFracHalf = 1;    // 2 * r can't fit into long
-                    } else {
-                        cmpFracHalf = longCompareMagnitude(2 * r, ldivisor);
-                    }
-                } else {
-                    cmpFracHalf = mr.compareHalf(mdivisor);
-                }
-                if (cmpFracHalf < 0)
-                    increment = false;     // We're closer to higher digit
-                else if (cmpFracHalf > 0)  // We're closer to lower digit
-                    increment = true;
-                else if (roundingMode == ROUND_HALF_UP)
-                    increment = true;
-                else if (roundingMode == ROUND_HALF_DOWN)
-                    increment = false;
-                else  // roundingMode == ROUND_HALF_EVEN, true iff quotient is odd
-                    increment = isLongDivision ? (q & 1L) != 0L : mq.isOdd();
-            }
-        }
-        BigDecimal res;
-        if (isLongDivision)
-            res = new BigDecimal(null, (increment ? q + qsign : q), scale, 0);
-        else {
-            if (increment)
-                mq.add(MutableBigInteger.ONE);
-            res = mq.toBigDecimal(qsign, scale);
-        }
-        if (isRemainderZero && preferredScale != scale)
-            res.stripZerosToMatchScale(preferredScale);
-        return res;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this /
-     * divisor)}, and whose scale is as specified.  If rounding must
-     * be performed to generate a result with the specified scale, the
-     * specified rounding mode is applied.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @param  scale scale of the {@code BigDecimal} quotient to be returned.
-     * @param  roundingMode rounding mode to apply.
-     * @return {@code this / divisor}
-     * @throws ArithmeticException if {@code divisor} is zero,
-     *         {@code roundingMode==RoundingMode.UNNECESSARY} and
-     *         the specified scale is insufficient to represent the result
-     *         of the division exactly.
-     * @since 1.5
-     */
-    public BigDecimal divide(BigDecimal divisor, int scale, RoundingMode roundingMode) {
-        return divide(divisor, scale, roundingMode.oldMode);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this /
-     * divisor)}, and whose scale is {@code this.scale()}.  If
-     * rounding must be performed to generate a result with the given
-     * scale, the specified rounding mode is applied.
-     *
-     * <p>The new {@link #divide(BigDecimal, RoundingMode)} method
-     * should be used in preference to this legacy method.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @param  roundingMode rounding mode to apply.
-     * @return {@code this / divisor}
-     * @throws ArithmeticException if {@code divisor==0}, or
-     *         {@code roundingMode==ROUND_UNNECESSARY} and
-     *         {@code this.scale()} is insufficient to represent the result
-     *         of the division exactly.
-     * @throws IllegalArgumentException if {@code roundingMode} does not
-     *         represent a valid rounding mode.
-     * @see    #ROUND_UP
-     * @see    #ROUND_DOWN
-     * @see    #ROUND_CEILING
-     * @see    #ROUND_FLOOR
-     * @see    #ROUND_HALF_UP
-     * @see    #ROUND_HALF_DOWN
-     * @see    #ROUND_HALF_EVEN
-     * @see    #ROUND_UNNECESSARY
-     */
-    public BigDecimal divide(BigDecimal divisor, int roundingMode) {
-            return this.divide(divisor, scale, roundingMode);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this /
-     * divisor)}, and whose scale is {@code this.scale()}.  If
-     * rounding must be performed to generate a result with the given
-     * scale, the specified rounding mode is applied.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @param  roundingMode rounding mode to apply.
-     * @return {@code this / divisor}
-     * @throws ArithmeticException if {@code divisor==0}, or
-     *         {@code roundingMode==RoundingMode.UNNECESSARY} and
-     *         {@code this.scale()} is insufficient to represent the result
-     *         of the division exactly.
-     * @since 1.5
-     */
-    public BigDecimal divide(BigDecimal divisor, RoundingMode roundingMode) {
-        return this.divide(divisor, scale, roundingMode.oldMode);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this /
-     * divisor)}, and whose preferred scale is {@code (this.scale() -
-     * divisor.scale())}; if the exact quotient cannot be
-     * represented (because it has a non-terminating decimal
-     * expansion) an {@code ArithmeticException} is thrown.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @throws ArithmeticException if the exact quotient does not have a
-     *         terminating decimal expansion
-     * @return {@code this / divisor}
-     * @since 1.5
-     * @author Joseph D. Darcy
-     */
-    public BigDecimal divide(BigDecimal divisor) {
-        /*
-         * Handle zero cases first.
-         */
-        if (divisor.signum() == 0) {   // x/0
-            if (this.signum() == 0)    // 0/0
-                throw new ArithmeticException("Division undefined");  // NaN
-            throw new ArithmeticException("Division by zero");
-        }
-
-        // Calculate preferred scale
-        int preferredScale = saturateLong((long)this.scale - divisor.scale);
-        if (this.signum() == 0)        // 0/y
-            return (preferredScale >= 0 &&
-                    preferredScale < ZERO_SCALED_BY.length) ?
-                ZERO_SCALED_BY[preferredScale] :
-                BigDecimal.valueOf(0, preferredScale);
-        else {
-            this.inflate();
-            divisor.inflate();
-            /*
-             * If the quotient this/divisor has a terminating decimal
-             * expansion, the expansion can have no more than
-             * (a.precision() + ceil(10*b.precision)/3) digits.
-             * Therefore, create a MathContext object with this
-             * precision and do a divide with the UNNECESSARY rounding
-             * mode.
-             */
-            MathContext mc = new MathContext( (int)Math.min(this.precision() +
-                                                            (long)Math.ceil(10.0*divisor.precision()/3.0),
-                                                            Integer.MAX_VALUE),
-                                              RoundingMode.UNNECESSARY);
-            BigDecimal quotient;
-            try {
-                quotient = this.divide(divisor, mc);
-            } catch (ArithmeticException e) {
-                throw new ArithmeticException("Non-terminating decimal expansion; " +
-                                              "no exact representable decimal result.");
-            }
-
-            int quotientScale = quotient.scale();
-
-            // divide(BigDecimal, mc) tries to adjust the quotient to
-            // the desired one by removing trailing zeros; since the
-            // exact divide method does not have an explicit digit
-            // limit, we can add zeros too.
-
-            if (preferredScale > quotientScale)
-                return quotient.setScale(preferredScale, ROUND_UNNECESSARY);
-
-            return quotient;
-        }
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this /
-     * divisor)}, with rounding according to the context settings.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @param  mc the context to use.
-     * @return {@code this / divisor}, rounded as necessary.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY} or
-     *         {@code mc.precision == 0} and the quotient has a
-     *         non-terminating decimal expansion.
-     * @since  1.5
-     */
-    public BigDecimal divide(BigDecimal divisor, MathContext mc) {
-        int mcp = mc.precision;
-        if (mcp == 0)
-            return divide(divisor);
-
-        BigDecimal dividend = this;
-        long preferredScale = (long)dividend.scale - divisor.scale;
-        // Now calculate the answer.  We use the existing
-        // divide-and-round method, but as this rounds to scale we have
-        // to normalize the values here to achieve the desired result.
-        // For x/y we first handle y=0 and x=0, and then normalize x and
-        // y to give x' and y' with the following constraints:
-        //   (a) 0.1 <= x' < 1
-        //   (b)  x' <= y' < 10*x'
-        // Dividing x'/y' with the required scale set to mc.precision then
-        // will give a result in the range 0.1 to 1 rounded to exactly
-        // the right number of digits (except in the case of a result of
-        // 1.000... which can arise when x=y, or when rounding overflows
-        // The 1.000... case will reduce properly to 1.
-        if (divisor.signum() == 0) {      // x/0
-            if (dividend.signum() == 0)    // 0/0
-                throw new ArithmeticException("Division undefined");  // NaN
-            throw new ArithmeticException("Division by zero");
-        }
-        if (dividend.signum() == 0)        // 0/y
-            return new BigDecimal(BigInteger.ZERO, 0,
-                                  saturateLong(preferredScale), 1);
-
-        // Normalize dividend & divisor so that both fall into [0.1, 0.999...]
-        int xscale = dividend.precision();
-        int yscale = divisor.precision();
-        dividend = new BigDecimal(dividend.intVal, dividend.intCompact,
-                                  xscale, xscale);
-        divisor = new BigDecimal(divisor.intVal, divisor.intCompact,
-                                 yscale, yscale);
-        if (dividend.compareMagnitude(divisor) > 0) // satisfy constraint (b)
-            yscale = divisor.scale -= 1;            // [that is, divisor *= 10]
-
-        // In order to find out whether the divide generates the exact result,
-        // we avoid calling the above divide method. 'quotient' holds the
-        // return BigDecimal object whose scale will be set to 'scl'.
-        BigDecimal quotient;
-        int scl = checkScale(preferredScale + yscale - xscale + mcp);
-        if (checkScale((long)mcp + yscale) > xscale)
-            dividend = dividend.setScale(mcp + yscale, ROUND_UNNECESSARY);
-        else
-            divisor = divisor.setScale(checkScale((long)xscale - mcp),
-                                       ROUND_UNNECESSARY);
-        quotient = divideAndRound(dividend.intCompact, dividend.intVal,
-                                  divisor.intCompact, divisor.intVal,
-                                  scl, mc.roundingMode.oldMode,
-                                  checkScale(preferredScale));
-        // doRound, here, only affects 1000000000 case.
-        quotient = doRound(quotient, mc);
-
-        return quotient;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is the integer part
-     * of the quotient {@code (this / divisor)} rounded down.  The
-     * preferred scale of the result is {@code (this.scale() -
-     * divisor.scale())}.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @return The integer part of {@code this / divisor}.
-     * @throws ArithmeticException if {@code divisor==0}
-     * @since  1.5
-     */
-    public BigDecimal divideToIntegralValue(BigDecimal divisor) {
-        // Calculate preferred scale
-        int preferredScale = saturateLong((long)this.scale - divisor.scale);
-        if (this.compareMagnitude(divisor) < 0) {
-            // much faster when this << divisor
-            return BigDecimal.valueOf(0, preferredScale);
-        }
-
-        if(this.signum() == 0 && divisor.signum() != 0)
-            return this.setScale(preferredScale, ROUND_UNNECESSARY);
-
-        // Perform a divide with enough digits to round to a correct
-        // integer value; then remove any fractional digits
-
-        int maxDigits = (int)Math.min(this.precision() +
-                                      (long)Math.ceil(10.0*divisor.precision()/3.0) +
-                                      Math.abs((long)this.scale() - divisor.scale()) + 2,
-                                      Integer.MAX_VALUE);
-        BigDecimal quotient = this.divide(divisor, new MathContext(maxDigits,
-                                                                   RoundingMode.DOWN));
-        if (quotient.scale > 0) {
-            quotient = quotient.setScale(0, RoundingMode.DOWN);
-            quotient.stripZerosToMatchScale(preferredScale);
-        }
-
-        if (quotient.scale < preferredScale) {
-            // pad with zeros if necessary
-            quotient = quotient.setScale(preferredScale, ROUND_UNNECESSARY);
-        }
-        return quotient;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is the integer part
-     * of {@code (this / divisor)}.  Since the integer part of the
-     * exact quotient does not depend on the rounding mode, the
-     * rounding mode does not affect the values returned by this
-     * method.  The preferred scale of the result is
-     * {@code (this.scale() - divisor.scale())}.  An
-     * {@code ArithmeticException} is thrown if the integer part of
-     * the exact quotient needs more than {@code mc.precision}
-     * digits.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @param  mc the context to use.
-     * @return The integer part of {@code this / divisor}.
-     * @throws ArithmeticException if {@code divisor==0}
-     * @throws ArithmeticException if {@code mc.precision} {@literal >} 0 and the result
-     *         requires a precision of more than {@code mc.precision} digits.
-     * @since  1.5
-     * @author Joseph D. Darcy
-     */
-    public BigDecimal divideToIntegralValue(BigDecimal divisor, MathContext mc) {
-        if (mc.precision == 0 ||                        // exact result
-            (this.compareMagnitude(divisor) < 0) )      // zero result
-            return divideToIntegralValue(divisor);
-
-        // Calculate preferred scale
-        int preferredScale = saturateLong((long)this.scale - divisor.scale);
-
-        /*
-         * Perform a normal divide to mc.precision digits.  If the
-         * remainder has absolute value less than the divisor, the
-         * integer portion of the quotient fits into mc.precision
-         * digits.  Next, remove any fractional digits from the
-         * quotient and adjust the scale to the preferred value.
-         */
-        BigDecimal result = this.
-            divide(divisor, new MathContext(mc.precision, RoundingMode.DOWN));
-
-        if (result.scale() < 0) {
-            /*
-             * Result is an integer. See if quotient represents the
-             * full integer portion of the exact quotient; if it does,
-             * the computed remainder will be less than the divisor.
-             */
-            BigDecimal product = result.multiply(divisor);
-            // If the quotient is the full integer value,
-            // |dividend-product| < |divisor|.
-            if (this.subtract(product).compareMagnitude(divisor) >= 0) {
-                throw new ArithmeticException("Division impossible");
-            }
-        } else if (result.scale() > 0) {
-            /*
-             * Integer portion of quotient will fit into precision
-             * digits; recompute quotient to scale 0 to avoid double
-             * rounding and then try to adjust, if necessary.
-             */
-            result = result.setScale(0, RoundingMode.DOWN);
-        }
-        // else result.scale() == 0;
-
-        int precisionDiff;
-        if ((preferredScale > result.scale()) &&
-            (precisionDiff = mc.precision - result.precision()) > 0) {
-            return result.setScale(result.scale() +
-                                   Math.min(precisionDiff, preferredScale - result.scale) );
-        } else {
-            result.stripZerosToMatchScale(preferredScale);
-            return result;
-        }
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this % divisor)}.
-     *
-     * <p>The remainder is given by
-     * {@code this.subtract(this.divideToIntegralValue(divisor).multiply(divisor))}.
-     * Note that this is not the modulo operation (the result can be
-     * negative).
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @return {@code this % divisor}.
-     * @throws ArithmeticException if {@code divisor==0}
-     * @since  1.5
-     */
-    public BigDecimal remainder(BigDecimal divisor) {
-        BigDecimal divrem[] = this.divideAndRemainder(divisor);
-        return divrem[1];
-    }
-
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (this %
-     * divisor)}, with rounding according to the context settings.
-     * The {@code MathContext} settings affect the implicit divide
-     * used to compute the remainder.  The remainder computation
-     * itself is by definition exact.  Therefore, the remainder may
-     * contain more than {@code mc.getPrecision()} digits.
-     *
-     * <p>The remainder is given by
-     * {@code this.subtract(this.divideToIntegralValue(divisor,
-     * mc).multiply(divisor))}.  Note that this is not the modulo
-     * operation (the result can be negative).
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided.
-     * @param  mc the context to use.
-     * @return {@code this % divisor}, rounded as necessary.
-     * @throws ArithmeticException if {@code divisor==0}
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}, or {@code mc.precision}
-     *         {@literal >} 0 and the result of {@code this.divideToIntgralValue(divisor)} would
-     *         require a precision of more than {@code mc.precision} digits.
-     * @see    #divideToIntegralValue(java.math.BigDecimal, java.math.MathContext)
-     * @since  1.5
-     */
-    public BigDecimal remainder(BigDecimal divisor, MathContext mc) {
-        BigDecimal divrem[] = this.divideAndRemainder(divisor, mc);
-        return divrem[1];
-    }
-
-    /**
-     * Returns a two-element {@code BigDecimal} array containing the
-     * result of {@code divideToIntegralValue} followed by the result of
-     * {@code remainder} on the two operands.
-     *
-     * <p>Note that if both the integer quotient and remainder are
-     * needed, this method is faster than using the
-     * {@code divideToIntegralValue} and {@code remainder} methods
-     * separately because the division need only be carried out once.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided,
-     *         and the remainder computed.
-     * @return a two element {@code BigDecimal} array: the quotient
-     *         (the result of {@code divideToIntegralValue}) is the initial element
-     *         and the remainder is the final element.
-     * @throws ArithmeticException if {@code divisor==0}
-     * @see    #divideToIntegralValue(java.math.BigDecimal, java.math.MathContext)
-     * @see    #remainder(java.math.BigDecimal, java.math.MathContext)
-     * @since  1.5
-     */
-    public BigDecimal[] divideAndRemainder(BigDecimal divisor) {
-        // we use the identity  x = i * y + r to determine r
-        BigDecimal[] result = new BigDecimal[2];
-
-        result[0] = this.divideToIntegralValue(divisor);
-        result[1] = this.subtract(result[0].multiply(divisor));
-        return result;
-    }
-
-    /**
-     * Returns a two-element {@code BigDecimal} array containing the
-     * result of {@code divideToIntegralValue} followed by the result of
-     * {@code remainder} on the two operands calculated with rounding
-     * according to the context settings.
-     *
-     * <p>Note that if both the integer quotient and remainder are
-     * needed, this method is faster than using the
-     * {@code divideToIntegralValue} and {@code remainder} methods
-     * separately because the division need only be carried out once.
-     *
-     * @param  divisor value by which this {@code BigDecimal} is to be divided,
-     *         and the remainder computed.
-     * @param  mc the context to use.
-     * @return a two element {@code BigDecimal} array: the quotient
-     *         (the result of {@code divideToIntegralValue}) is the
-     *         initial element and the remainder is the final element.
-     * @throws ArithmeticException if {@code divisor==0}
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}, or {@code mc.precision}
-     *         {@literal >} 0 and the result of {@code this.divideToIntgralValue(divisor)} would
-     *         require a precision of more than {@code mc.precision} digits.
-     * @see    #divideToIntegralValue(java.math.BigDecimal, java.math.MathContext)
-     * @see    #remainder(java.math.BigDecimal, java.math.MathContext)
-     * @since  1.5
-     */
-    public BigDecimal[] divideAndRemainder(BigDecimal divisor, MathContext mc) {
-        if (mc.precision == 0)
-            return divideAndRemainder(divisor);
-
-        BigDecimal[] result = new BigDecimal[2];
-        BigDecimal lhs = this;
-
-        result[0] = lhs.divideToIntegralValue(divisor, mc);
-        result[1] = lhs.subtract(result[0].multiply(divisor));
-        return result;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is
-     * <tt>(this<sup>n</sup>)</tt>, The power is computed exactly, to
-     * unlimited precision.
-     *
-     * <p>The parameter {@code n} must be in the range 0 through
-     * 999999999, inclusive.  {@code ZERO.pow(0)} returns {@link
-     * #ONE}.
-     *
-     * Note that future releases may expand the allowable exponent
-     * range of this method.
-     *
-     * @param  n power to raise this {@code BigDecimal} to.
-     * @return <tt>this<sup>n</sup></tt>
-     * @throws ArithmeticException if {@code n} is out of range.
-     * @since  1.5
-     */
-    public BigDecimal pow(int n) {
-        if (n < 0 || n > 999999999)
-            throw new ArithmeticException("Invalid operation");
-        // No need to calculate pow(n) if result will over/underflow.
-        // Don't attempt to support "supernormal" numbers.
-        int newScale = checkScale((long)scale * n);
-        this.inflate();
-        return new BigDecimal(intVal.pow(n), newScale);
-    }
-
-
-    /**
-     * Returns a {@code BigDecimal} whose value is
-     * <tt>(this<sup>n</sup>)</tt>.  The current implementation uses
-     * the core algorithm defined in ANSI standard X3.274-1996 with
-     * rounding according to the context settings.  In general, the
-     * returned numerical value is within two ulps of the exact
-     * numerical value for the chosen precision.  Note that future
-     * releases may use a different algorithm with a decreased
-     * allowable error bound and increased allowable exponent range.
-     *
-     * <p>The X3.274-1996 algorithm is:
-     *
-     * <ul>
-     * <li> An {@code ArithmeticException} exception is thrown if
-     *  <ul>
-     *    <li>{@code abs(n) > 999999999}
-     *    <li>{@code mc.precision == 0} and {@code n < 0}
-     *    <li>{@code mc.precision > 0} and {@code n} has more than
-     *    {@code mc.precision} decimal digits
-     *  </ul>
-     *
-     * <li> if {@code n} is zero, {@link #ONE} is returned even if
-     * {@code this} is zero, otherwise
-     * <ul>
-     *   <li> if {@code n} is positive, the result is calculated via
-     *   the repeated squaring technique into a single accumulator.
-     *   The individual multiplications with the accumulator use the
-     *   same math context settings as in {@code mc} except for a
-     *   precision increased to {@code mc.precision + elength + 1}
-     *   where {@code elength} is the number of decimal digits in
-     *   {@code n}.
-     *
-     *   <li> if {@code n} is negative, the result is calculated as if
-     *   {@code n} were positive; this value is then divided into one
-     *   using the working precision specified above.
-     *
-     *   <li> The final value from either the positive or negative case
-     *   is then rounded to the destination precision.
-     *   </ul>
-     * </ul>
-     *
-     * @param  n power to raise this {@code BigDecimal} to.
-     * @param  mc the context to use.
-     * @return <tt>this<sup>n</sup></tt> using the ANSI standard X3.274-1996
-     *         algorithm
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}, or {@code n} is out
-     *         of range.
-     * @since  1.5
-     */
-    public BigDecimal pow(int n, MathContext mc) {
-        if (mc.precision == 0)
-            return pow(n);
-        if (n < -999999999 || n > 999999999)
-            throw new ArithmeticException("Invalid operation");
-        if (n == 0)
-            return ONE;                      // x**0 == 1 in X3.274
-        this.inflate();
-        BigDecimal lhs = this;
-        MathContext workmc = mc;           // working settings
-        int mag = Math.abs(n);               // magnitude of n
-        if (mc.precision > 0) {
-
-            int elength = longDigitLength(mag); // length of n in digits
-            if (elength > mc.precision)        // X3.274 rule
-                throw new ArithmeticException("Invalid operation");
-            workmc = new MathContext(mc.precision + elength + 1,
-                                      mc.roundingMode);
-        }
-        // ready to carry out power calculation...
-        BigDecimal acc = ONE;           // accumulator
-        boolean seenbit = false;        // set once we've seen a 1-bit
-        for (int i=1;;i++) {            // for each bit [top bit ignored]
-            mag += mag;                 // shift left 1 bit
-            if (mag < 0) {              // top bit is set
-                seenbit = true;         // OK, we're off
-                acc = acc.multiply(lhs, workmc); // acc=acc*x
-            }
-            if (i == 31)
-                break;                  // that was the last bit
-            if (seenbit)
-                acc=acc.multiply(acc, workmc);   // acc=acc*acc [square]
-                // else (!seenbit) no point in squaring ONE
-        }
-        // if negative n, calculate the reciprocal using working precision
-        if (n<0)                          // [hence mc.precision>0]
-            acc=ONE.divide(acc, workmc);
-        // round to final precision and strip zeros
-        return doRound(acc, mc);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is the absolute value
-     * of this {@code BigDecimal}, and whose scale is
-     * {@code this.scale()}.
-     *
-     * @return {@code abs(this)}
-     */
-    public BigDecimal abs() {
-        return (signum() < 0 ? negate() : this);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is the absolute value
-     * of this {@code BigDecimal}, with rounding according to the
-     * context settings.
-     *
-     * @param mc the context to use.
-     * @return {@code abs(this)}, rounded as necessary.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since 1.5
-     */
-    public BigDecimal abs(MathContext mc) {
-        return (signum() < 0 ? negate(mc) : plus(mc));
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (-this)},
-     * and whose scale is {@code this.scale()}.
-     *
-     * @return {@code -this}.
-     */
-    public BigDecimal negate() {
-        BigDecimal result;
-        if (intCompact != INFLATED)
-            result = BigDecimal.valueOf(-intCompact, scale);
-        else {
-            result = new BigDecimal(intVal.negate(), scale);
-            result.precision = precision;
-        }
-        return result;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (-this)},
-     * with rounding according to the context settings.
-     *
-     * @param mc the context to use.
-     * @return {@code -this}, rounded as necessary.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @since  1.5
-     */
-    public BigDecimal negate(MathContext mc) {
-        return negate().plus(mc);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (+this)}, and whose
-     * scale is {@code this.scale()}.
-     *
-     * <p>This method, which simply returns this {@code BigDecimal}
-     * is included for symmetry with the unary minus method {@link
-     * #negate()}.
-     *
-     * @return {@code this}.
-     * @see #negate()
-     * @since  1.5
-     */
-    public BigDecimal plus() {
-        return this;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose value is {@code (+this)},
-     * with rounding according to the context settings.
-     *
-     * <p>The effect of this method is identical to that of the {@link
-     * #round(MathContext)} method.
-     *
-     * @param mc the context to use.
-     * @return {@code this}, rounded as necessary.  A zero result will
-     *         have a scale of 0.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     * @see    #round(MathContext)
-     * @since  1.5
-     */
-    public BigDecimal plus(MathContext mc) {
-        if (mc.precision == 0)                 // no rounding please
-            return this;
-        return doRound(this, mc);
-    }
-
-    /**
-     * Returns the signum function of this {@code BigDecimal}.
-     *
-     * @return -1, 0, or 1 as the value of this {@code BigDecimal}
-     *         is negative, zero, or positive.
-     */
-    public int signum() {
-        return (intCompact != INFLATED)?
-            Long.signum(intCompact):
-            intVal.signum();
-    }
-
-    /**
-     * Returns the <i>scale</i> of this {@code BigDecimal}.  If zero
-     * or positive, the scale is the number of digits to the right of
-     * the decimal point.  If negative, the unscaled value of the
-     * number is multiplied by ten to the power of the negation of the
-     * scale.  For example, a scale of {@code -3} means the unscaled
-     * value is multiplied by 1000.
-     *
-     * @return the scale of this {@code BigDecimal}.
-     */
-    public int scale() {
-        return scale;
-    }
-
-    /**
-     * Returns the <i>precision</i> of this {@code BigDecimal}.  (The
-     * precision is the number of digits in the unscaled value.)
-     *
-     * <p>The precision of a zero value is 1.
-     *
-     * @return the precision of this {@code BigDecimal}.
-     * @since  1.5
-     */
-    public int precision() {
-        int result = precision;
-        if (result == 0) {
-            long s = intCompact;
-            if (s != INFLATED)
-                result = longDigitLength(s);
-            else
-                result = bigDigitLength(inflate());
-            precision = result;
-        }
-        return result;
-    }
-
-
-    /**
-     * Returns a {@code BigInteger} whose value is the <i>unscaled
-     * value</i> of this {@code BigDecimal}.  (Computes <tt>(this *
-     * 10<sup>this.scale()</sup>)</tt>.)
-     *
-     * @return the unscaled value of this {@code BigDecimal}.
-     * @since  1.2
-     */
-    public BigInteger unscaledValue() {
-        return this.inflate();
-    }
-
-    // Rounding Modes
-
-    /**
-     * Rounding mode to round away from zero.  Always increments the
-     * digit prior to a nonzero discarded fraction.  Note that this rounding
-     * mode never decreases the magnitude of the calculated value.
-     */
-    public final static int ROUND_UP =           0;
-
-    /**
-     * Rounding mode to round towards zero.  Never increments the digit
-     * prior to a discarded fraction (i.e., truncates).  Note that this
-     * rounding mode never increases the magnitude of the calculated value.
-     */
-    public final static int ROUND_DOWN =         1;
-
-    /**
-     * Rounding mode to round towards positive infinity.  If the
-     * {@code BigDecimal} is positive, behaves as for
-     * {@code ROUND_UP}; if negative, behaves as for
-     * {@code ROUND_DOWN}.  Note that this rounding mode never
-     * decreases the calculated value.
-     */
-    public final static int ROUND_CEILING =      2;
-
-    /**
-     * Rounding mode to round towards negative infinity.  If the
-     * {@code BigDecimal} is positive, behave as for
-     * {@code ROUND_DOWN}; if negative, behave as for
-     * {@code ROUND_UP}.  Note that this rounding mode never
-     * increases the calculated value.
-     */
-    public final static int ROUND_FLOOR =        3;
-
-    /**
-     * Rounding mode to round towards {@literal "nearest neighbor"}
-     * unless both neighbors are equidistant, in which case round up.
-     * Behaves as for {@code ROUND_UP} if the discarded fraction is
-     * &ge; 0.5; otherwise, behaves as for {@code ROUND_DOWN}.  Note
-     * that this is the rounding mode that most of us were taught in
-     * grade school.
-     */
-    public final static int ROUND_HALF_UP =      4;
-
-    /**
-     * Rounding mode to round towards {@literal "nearest neighbor"}
-     * unless both neighbors are equidistant, in which case round
-     * down.  Behaves as for {@code ROUND_UP} if the discarded
-     * fraction is {@literal >} 0.5; otherwise, behaves as for
-     * {@code ROUND_DOWN}.
-     */
-    public final static int ROUND_HALF_DOWN =    5;
-
-    /**
-     * Rounding mode to round towards the {@literal "nearest neighbor"}
-     * unless both neighbors are equidistant, in which case, round
-     * towards the even neighbor.  Behaves as for
-     * {@code ROUND_HALF_UP} if the digit to the left of the
-     * discarded fraction is odd; behaves as for
-     * {@code ROUND_HALF_DOWN} if it's even.  Note that this is the
-     * rounding mode that minimizes cumulative error when applied
-     * repeatedly over a sequence of calculations.
-     */
-    public final static int ROUND_HALF_EVEN =    6;
-
-    /**
-     * Rounding mode to assert that the requested operation has an exact
-     * result, hence no rounding is necessary.  If this rounding mode is
-     * specified on an operation that yields an inexact result, an
-     * {@code ArithmeticException} is thrown.
-     */
-    public final static int ROUND_UNNECESSARY =  7;
-
-
-    // Scaling/Rounding Operations
-
-    /**
-     * Returns a {@code BigDecimal} rounded according to the
-     * {@code MathContext} settings.  If the precision setting is 0 then
-     * no rounding takes place.
-     *
-     * <p>The effect of this method is identical to that of the
-     * {@link #plus(MathContext)} method.
-     *
-     * @param mc the context to use.
-     * @return a {@code BigDecimal} rounded according to the
-     *         {@code MathContext} settings.
-     * @throws ArithmeticException if the rounding mode is
-     *         {@code UNNECESSARY} and the
-     *         {@code BigDecimal}  operation would require rounding.
-     * @see    #plus(MathContext)
-     * @since  1.5
-     */
-    public BigDecimal round(MathContext mc) {
-        return plus(mc);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose scale is the specified
-     * value, and whose unscaled value is determined by multiplying or
-     * dividing this {@code BigDecimal}'s unscaled value by the
-     * appropriate power of ten to maintain its overall value.  If the
-     * scale is reduced by the operation, the unscaled value must be
-     * divided (rather than multiplied), and the value may be changed;
-     * in this case, the specified rounding mode is applied to the
-     * division.
-     *
-     * <p>Note that since BigDecimal objects are immutable, calls of
-     * this method do <i>not</i> result in the original object being
-     * modified, contrary to the usual convention of having methods
-     * named <tt>set<i>X</i></tt> mutate field <i>{@code X}</i>.
-     * Instead, {@code setScale} returns an object with the proper
-     * scale; the returned object may or may not be newly allocated.
-     *
-     * @param  newScale scale of the {@code BigDecimal} value to be returned.
-     * @param  roundingMode The rounding mode to apply.
-     * @return a {@code BigDecimal} whose scale is the specified value,
-     *         and whose unscaled value is determined by multiplying or
-     *         dividing this {@code BigDecimal}'s unscaled value by the
-     *         appropriate power of ten to maintain its overall value.
-     * @throws ArithmeticException if {@code roundingMode==UNNECESSARY}
-     *         and the specified scaling operation would require
-     *         rounding.
-     * @see    RoundingMode
-     * @since  1.5
-     */
-    public BigDecimal setScale(int newScale, RoundingMode roundingMode) {
-        return setScale(newScale, roundingMode.oldMode);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose scale is the specified
-     * value, and whose unscaled value is determined by multiplying or
-     * dividing this {@code BigDecimal}'s unscaled value by the
-     * appropriate power of ten to maintain its overall value.  If the
-     * scale is reduced by the operation, the unscaled value must be
-     * divided (rather than multiplied), and the value may be changed;
-     * in this case, the specified rounding mode is applied to the
-     * division.
-     *
-     * <p>Note that since BigDecimal objects are immutable, calls of
-     * this method do <i>not</i> result in the original object being
-     * modified, contrary to the usual convention of having methods
-     * named <tt>set<i>X</i></tt> mutate field <i>{@code X}</i>.
-     * Instead, {@code setScale} returns an object with the proper
-     * scale; the returned object may or may not be newly allocated.
-     *
-     * <p>The new {@link #setScale(int, RoundingMode)} method should
-     * be used in preference to this legacy method.
-     *
-     * @param  newScale scale of the {@code BigDecimal} value to be returned.
-     * @param  roundingMode The rounding mode to apply.
-     * @return a {@code BigDecimal} whose scale is the specified value,
-     *         and whose unscaled value is determined by multiplying or
-     *         dividing this {@code BigDecimal}'s unscaled value by the
-     *         appropriate power of ten to maintain its overall value.
-     * @throws ArithmeticException if {@code roundingMode==ROUND_UNNECESSARY}
-     *         and the specified scaling operation would require
-     *         rounding.
-     * @throws IllegalArgumentException if {@code roundingMode} does not
-     *         represent a valid rounding mode.
-     * @see    #ROUND_UP
-     * @see    #ROUND_DOWN
-     * @see    #ROUND_CEILING
-     * @see    #ROUND_FLOOR
-     * @see    #ROUND_HALF_UP
-     * @see    #ROUND_HALF_DOWN
-     * @see    #ROUND_HALF_EVEN
-     * @see    #ROUND_UNNECESSARY
-     */
-    public BigDecimal setScale(int newScale, int roundingMode) {
-        if (roundingMode < ROUND_UP || roundingMode > ROUND_UNNECESSARY)
-            throw new IllegalArgumentException("Invalid rounding mode");
-
-        int oldScale = this.scale;
-        if (newScale == oldScale)        // easy case
-            return this;
-        if (this.signum() == 0)            // zero can have any scale
-            return BigDecimal.valueOf(0, newScale);
-
-        long rs = this.intCompact;
-        if (newScale > oldScale) {
-            int raise = checkScale((long)newScale - oldScale);
-            BigInteger rb = null;
-            if (rs == INFLATED ||
-                (rs = longMultiplyPowerTen(rs, raise)) == INFLATED)
-                rb = bigMultiplyPowerTen(raise);
-            return new BigDecimal(rb, rs, newScale,
-                                  (precision > 0) ? precision + raise : 0);
-        } else {
-            // newScale < oldScale -- drop some digits
-            // Can't predict the precision due to the effect of rounding.
-            int drop = checkScale((long)oldScale - newScale);
-            if (drop < LONG_TEN_POWERS_TABLE.length)
-                return divideAndRound(rs, this.intVal,
-                                      LONG_TEN_POWERS_TABLE[drop], null,
-                                      newScale, roundingMode, newScale);
-            else
-                return divideAndRound(rs, this.intVal,
-                                      INFLATED, bigTenToThe(drop),
-                                      newScale, roundingMode, newScale);
-        }
-    }
-
-    /**
-     * Returns a {@code BigDecimal} whose scale is the specified
-     * value, and whose value is numerically equal to this
-     * {@code BigDecimal}'s.  Throws an {@code ArithmeticException}
-     * if this is not possible.
-     *
-     * <p>This call is typically used to increase the scale, in which
-     * case it is guaranteed that there exists a {@code BigDecimal}
-     * of the specified scale and the correct value.  The call can
-     * also be used to reduce the scale if the caller knows that the
-     * {@code BigDecimal} has sufficiently many zeros at the end of
-     * its fractional part (i.e., factors of ten in its integer value)
-     * to allow for the rescaling without changing its value.
-     *
-     * <p>This method returns the same result as the two-argument
-     * versions of {@code setScale}, but saves the caller the trouble
-     * of specifying a rounding mode in cases where it is irrelevant.
-     *
-     * <p>Note that since {@code BigDecimal} objects are immutable,
-     * calls of this method do <i>not</i> result in the original
-     * object being modified, contrary to the usual convention of
-     * having methods named <tt>set<i>X</i></tt> mutate field
-     * <i>{@code X}</i>.  Instead, {@code setScale} returns an
-     * object with the proper scale; the returned object may or may
-     * not be newly allocated.
-     *
-     * @param  newScale scale of the {@code BigDecimal} value to be returned.
-     * @return a {@code BigDecimal} whose scale is the specified value, and
-     *         whose unscaled value is determined by multiplying or dividing
-     *         this {@code BigDecimal}'s unscaled value by the appropriate
-     *         power of ten to maintain its overall value.
-     * @throws ArithmeticException if the specified scaling operation would
-     *         require rounding.
-     * @see    #setScale(int, int)
-     * @see    #setScale(int, RoundingMode)
-     */
-    public BigDecimal setScale(int newScale) {
-        return setScale(newScale, ROUND_UNNECESSARY);
-    }
-
-    // Decimal Point Motion Operations
-
-    /**
-     * Returns a {@code BigDecimal} which is equivalent to this one
-     * with the decimal point moved {@code n} places to the left.  If
-     * {@code n} is non-negative, the call merely adds {@code n} to
-     * the scale.  If {@code n} is negative, the call is equivalent
-     * to {@code movePointRight(-n)}.  The {@code BigDecimal}
-     * returned by this call has value <tt>(this &times;
-     * 10<sup>-n</sup>)</tt> and scale {@code max(this.scale()+n,
-     * 0)}.
-     *
-     * @param  n number of places to move the decimal point to the left.
-     * @return a {@code BigDecimal} which is equivalent to this one with the
-     *         decimal point moved {@code n} places to the left.
-     * @throws ArithmeticException if scale overflows.
-     */
-    public BigDecimal movePointLeft(int n) {
-        // Cannot use movePointRight(-n) in case of n==Integer.MIN_VALUE
-        int newScale = checkScale((long)scale + n);
-        BigDecimal num = new BigDecimal(intVal, intCompact, newScale, 0);
-        return num.scale < 0 ? num.setScale(0, ROUND_UNNECESSARY) : num;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} which is equivalent to this one
-     * with the decimal point moved {@code n} places to the right.
-     * If {@code n} is non-negative, the call merely subtracts
-     * {@code n} from the scale.  If {@code n} is negative, the call
-     * is equivalent to {@code movePointLeft(-n)}.  The
-     * {@code BigDecimal} returned by this call has value <tt>(this
-     * &times; 10<sup>n</sup>)</tt> and scale {@code max(this.scale()-n,
-     * 0)}.
-     *
-     * @param  n number of places to move the decimal point to the right.
-     * @return a {@code BigDecimal} which is equivalent to this one
-     *         with the decimal point moved {@code n} places to the right.
-     * @throws ArithmeticException if scale overflows.
-     */
-    public BigDecimal movePointRight(int n) {
-        // Cannot use movePointLeft(-n) in case of n==Integer.MIN_VALUE
-        int newScale = checkScale((long)scale - n);
-        BigDecimal num = new BigDecimal(intVal, intCompact, newScale, 0);
-        return num.scale < 0 ? num.setScale(0, ROUND_UNNECESSARY) : num;
-    }
-
-    /**
-     * Returns a BigDecimal whose numerical value is equal to
-     * ({@code this} * 10<sup>n</sup>).  The scale of
-     * the result is {@code (this.scale() - n)}.
-     *
-     * @throws ArithmeticException if the scale would be
-     *         outside the range of a 32-bit integer.
-     *
-     * @since 1.5
-     */
-    public BigDecimal scaleByPowerOfTen(int n) {
-        return new BigDecimal(intVal, intCompact,
-                              checkScale((long)scale - n), precision);
-    }
-
-    /**
-     * Returns a {@code BigDecimal} which is numerically equal to
-     * this one but with any trailing zeros removed from the
-     * representation.  For example, stripping the trailing zeros from
-     * the {@code BigDecimal} value {@code 600.0}, which has
-     * [{@code BigInteger}, {@code scale}] components equals to
-     * [6000, 1], yields {@code 6E2} with [{@code BigInteger},
-     * {@code scale}] components equals to [6, -2]
-     *
-     * @return a numerically equal {@code BigDecimal} with any
-     * trailing zeros removed.
-     * @since 1.5
-     */
-    public BigDecimal stripTrailingZeros() {
-        this.inflate();
-        BigDecimal result = new BigDecimal(intVal, scale);
-        result.stripZerosToMatchScale(Long.MIN_VALUE);
-        return result;
-    }
-
-    // Comparison Operations
-
-    /**
-     * Compares this {@code BigDecimal} with the specified
-     * {@code BigDecimal}.  Two {@code BigDecimal} objects that are
-     * equal in value but have a different scale (like 2.0 and 2.00)
-     * are considered equal by this method.  This method is provided
-     * in preference to individual methods for each of the six boolean
-     * comparison operators ({@literal <}, ==,
-     * {@literal >}, {@literal >=}, !=, {@literal <=}).  The
-     * suggested idiom for performing these comparisons is:
-     * {@code (x.compareTo(y)} &lt;<i>op</i>&gt; {@code 0)}, where
-     * &lt;<i>op</i>&gt; is one of the six comparison operators.
-     *
-     * @param  val {@code BigDecimal} to which this {@code BigDecimal} is
-     *         to be compared.
-     * @return -1, 0, or 1 as this {@code BigDecimal} is numerically
-     *          less than, equal to, or greater than {@code val}.
-     */
-    public int compareTo(BigDecimal val) {
-        // Quick path for equal scale and non-inflated case.
-        if (scale == val.scale) {
-            long xs = intCompact;
-            long ys = val.intCompact;
-            if (xs != INFLATED && ys != INFLATED)
-                return xs != ys ? ((xs > ys) ? 1 : -1) : 0;
-        }
-        int xsign = this.signum();
-        int ysign = val.signum();
-        if (xsign != ysign)
-            return (xsign > ysign) ? 1 : -1;
-        if (xsign == 0)
-            return 0;
-        int cmp = compareMagnitude(val);
-        return (xsign > 0) ? cmp : -cmp;
-    }
-
-    /**
-     * Version of compareTo that ignores sign.
-     */
-    private int compareMagnitude(BigDecimal val) {
-        // Match scales, avoid unnecessary inflation
-        long ys = val.intCompact;
-        long xs = this.intCompact;
-        if (xs == 0)
-            return (ys == 0) ? 0 : -1;
-        if (ys == 0)
-            return 1;
-
-        int sdiff = this.scale - val.scale;
-        if (sdiff != 0) {
-            // Avoid matching scales if the (adjusted) exponents differ
-            int xae = this.precision() - this.scale;   // [-1]
-            int yae = val.precision() - val.scale;     // [-1]
-            if (xae < yae)
-                return -1;
-            if (xae > yae)
-                return 1;
-            BigInteger rb = null;
-            if (sdiff < 0) {
-                if ( (xs == INFLATED ||
-                      (xs = longMultiplyPowerTen(xs, -sdiff)) == INFLATED) &&
-                     ys == INFLATED) {
-                    rb = bigMultiplyPowerTen(-sdiff);
-                    return rb.compareMagnitude(val.intVal);
-                }
-            } else { // sdiff > 0
-                if ( (ys == INFLATED ||
-                      (ys = longMultiplyPowerTen(ys, sdiff)) == INFLATED) &&
-                     xs == INFLATED) {
-                    rb = val.bigMultiplyPowerTen(sdiff);
-                    return this.intVal.compareMagnitude(rb);
-                }
-            }
-        }
-        if (xs != INFLATED)
-            return (ys != INFLATED) ? longCompareMagnitude(xs, ys) : -1;
-        else if (ys != INFLATED)
-            return 1;
-        else
-            return this.intVal.compareMagnitude(val.intVal);
-    }
-
-    /**
-     * Compares this {@code BigDecimal} with the specified
-     * {@code Object} for equality.  Unlike {@link
-     * #compareTo(BigDecimal) compareTo}, this method considers two
-     * {@code BigDecimal} objects equal only if they are equal in
-     * value and scale (thus 2.0 is not equal to 2.00 when compared by
-     * this method).
-     *
-     * @param  x {@code Object} to which this {@code BigDecimal} is
-     *         to be compared.
-     * @return {@code true} if and only if the specified {@code Object} is a
-     *         {@code BigDecimal} whose value and scale are equal to this
-     *         {@code BigDecimal}'s.
-     * @see    #compareTo(java.math.BigDecimal)
-     * @see    #hashCode
-     */
-    @Override
-    public boolean equals(Object x) {
-        if (!(x instanceof BigDecimal))
-            return false;
-        BigDecimal xDec = (BigDecimal) x;
-        if (x == this)
-            return true;
-        if (scale != xDec.scale)
-            return false;
-        long s = this.intCompact;
-        long xs = xDec.intCompact;
-        if (s != INFLATED) {
-            if (xs == INFLATED)
-                xs = compactValFor(xDec.intVal);
-            return xs == s;
-        } else if (xs != INFLATED)
-            return xs == compactValFor(this.intVal);
-
-        return this.inflate().equals(xDec.inflate());
-    }
-
-    /**
-     * Returns the minimum of this {@code BigDecimal} and
-     * {@code val}.
-     *
-     * @param  val value with which the minimum is to be computed.
-     * @return the {@code BigDecimal} whose value is the lesser of this
-     *         {@code BigDecimal} and {@code val}.  If they are equal,
-     *         as defined by the {@link #compareTo(BigDecimal) compareTo}
-     *         method, {@code this} is returned.
-     * @see    #compareTo(java.math.BigDecimal)
-     */
-    public BigDecimal min(BigDecimal val) {
-        return (compareTo(val) <= 0 ? this : val);
-    }
-
-    /**
-     * Returns the maximum of this {@code BigDecimal} and {@code val}.
-     *
-     * @param  val value with which the maximum is to be computed.
-     * @return the {@code BigDecimal} whose value is the greater of this
-     *         {@code BigDecimal} and {@code val}.  If they are equal,
-     *         as defined by the {@link #compareTo(BigDecimal) compareTo}
-     *         method, {@code this} is returned.
-     * @see    #compareTo(java.math.BigDecimal)
-     */
-    public BigDecimal max(BigDecimal val) {
-        return (compareTo(val) >= 0 ? this : val);
-    }
-
-    // Hash Function
-
-    /**
-     * Returns the hash code for this {@code BigDecimal}.  Note that
-     * two {@code BigDecimal} objects that are numerically equal but
-     * differ in scale (like 2.0 and 2.00) will generally <i>not</i>
-     * have the same hash code.
-     *
-     * @return hash code for this {@code BigDecimal}.
-     * @see #equals(Object)
-     */
-    @Override
-    public int hashCode() {
-        if (intCompact != INFLATED) {
-            long val2 = (intCompact < 0)? -intCompact : intCompact;
-            int temp = (int)( ((int)(val2 >>> 32)) * 31  +
-                              (val2 & LONG_MASK));
-            return 31*((intCompact < 0) ?-temp:temp) + scale;
-        } else
-            return 31*intVal.hashCode() + scale;
-    }
-
-    // Format Converters
-
-    /**
-     * Returns the string representation of this {@code BigDecimal},
-     * using scientific notation if an exponent is needed.
-     *
-     * <p>A standard canonical string form of the {@code BigDecimal}
-     * is created as though by the following steps: first, the
-     * absolute value of the unscaled value of the {@code BigDecimal}
-     * is converted to a string in base ten using the characters
-     * {@code '0'} through {@code '9'} with no leading zeros (except
-     * if its value is zero, in which case a single {@code '0'}
-     * character is used).
-     *
-     * <p>Next, an <i>adjusted exponent</i> is calculated; this is the
-     * negated scale, plus the number of characters in the converted
-     * unscaled value, less one.  That is,
-     * {@code -scale+(ulength-1)}, where {@code ulength} is the
-     * length of the absolute value of the unscaled value in decimal
-     * digits (its <i>precision</i>).
-     *
-     * <p>If the scale is greater than or equal to zero and the
-     * adjusted exponent is greater than or equal to {@code -6}, the
-     * number will be converted to a character form without using
-     * exponential notation.  In this case, if the scale is zero then
-     * no decimal point is added and if the scale is positive a
-     * decimal point will be inserted with the scale specifying the
-     * number of characters to the right of the decimal point.
-     * {@code '0'} characters are added to the left of the converted
-     * unscaled value as necessary.  If no character precedes the
-     * decimal point after this insertion then a conventional
-     * {@code '0'} character is prefixed.
-     *
-     * <p>Otherwise (that is, if the scale is negative, or the
-     * adjusted exponent is less than {@code -6}), the number will be
-     * converted to a character form using exponential notation.  In
-     * this case, if the converted {@code BigInteger} has more than
-     * one digit a decimal point is inserted after the first digit.
-     * An exponent in character form is then suffixed to the converted
-     * unscaled value (perhaps with inserted decimal point); this
-     * comprises the letter {@code 'E'} followed immediately by the
-     * adjusted exponent converted to a character form.  The latter is
-     * in base ten, using the characters {@code '0'} through
-     * {@code '9'} with no leading zeros, and is always prefixed by a
-     * sign character {@code '-'} (<tt>'&#92;u002D'</tt>) if the
-     * adjusted exponent is negative, {@code '+'}
-     * (<tt>'&#92;u002B'</tt>) otherwise).
-     *
-     * <p>Finally, the entire string is prefixed by a minus sign
-     * character {@code '-'} (<tt>'&#92;u002D'</tt>) if the unscaled
-     * value is less than zero.  No sign character is prefixed if the
-     * unscaled value is zero or positive.
-     *
-     * <p><b>Examples:</b>
-     * <p>For each representation [<i>unscaled value</i>, <i>scale</i>]
-     * on the left, the resulting string is shown on the right.
-     * <pre>
-     * [123,0]      "123"
-     * [-123,0]     "-123"
-     * [123,-1]     "1.23E+3"
-     * [123,-3]     "1.23E+5"
-     * [123,1]      "12.3"
-     * [123,5]      "0.00123"
-     * [123,10]     "1.23E-8"
-     * [-123,12]    "-1.23E-10"
-     * </pre>
-     *
-     * <b>Notes:</b>
-     * <ol>
-     *
-     * <li>There is a one-to-one mapping between the distinguishable
-     * {@code BigDecimal} values and the result of this conversion.
-     * That is, every distinguishable {@code BigDecimal} value
-     * (unscaled value and scale) has a unique string representation
-     * as a result of using {@code toString}.  If that string
-     * representation is converted back to a {@code BigDecimal} using
-     * the {@link #BigDecimal(String)} constructor, then the original
-     * value will be recovered.
-     *
-     * <li>The string produced for a given number is always the same;
-     * it is not affected by locale.  This means that it can be used
-     * as a canonical string representation for exchanging decimal
-     * data, or as a key for a Hashtable, etc.  Locale-sensitive
-     * number formatting and parsing is handled by the {@link
-     * java.text.NumberFormat} class and its subclasses.
-     *
-     * <li>The {@link #toEngineeringString} method may be used for
-     * presenting numbers with exponents in engineering notation, and the
-     * {@link #setScale(int,RoundingMode) setScale} method may be used for
-     * rounding a {@code BigDecimal} so it has a known number of digits after
-     * the decimal point.
-     *
-     * <li>The digit-to-character mapping provided by
-     * {@code Character.forDigit} is used.
-     *
-     * </ol>
-     *
-     * @return string representation of this {@code BigDecimal}.
-     * @see    Character#forDigit
-     * @see    #BigDecimal(java.lang.String)
-     */
-    @Override
-    public String toString() {
-        String sc = stringCache;
-        if (sc == null)
-            stringCache = sc = layoutChars(true);
-        return sc;
-    }
-
-    /**
-     * Returns a string representation of this {@code BigDecimal},
-     * using engineering notation if an exponent is needed.
-     *
-     * <p>Returns a string that represents the {@code BigDecimal} as
-     * described in the {@link #toString()} method, except that if
-     * exponential notation is used, the power of ten is adjusted to
-     * be a multiple of three (engineering notation) such that the
-     * integer part of nonzero values will be in the range 1 through
-     * 999.  If exponential notation is used for zero values, a
-     * decimal point and one or two fractional zero digits are used so
-     * that the scale of the zero value is preserved.  Note that
-     * unlike the output of {@link #toString()}, the output of this
-     * method is <em>not</em> guaranteed to recover the same [integer,
-     * scale] pair of this {@code BigDecimal} if the output string is
-     * converting back to a {@code BigDecimal} using the {@linkplain
-     * #BigDecimal(String) string constructor}.  The result of this method meets
-     * the weaker constraint of always producing a numerically equal
-     * result from applying the string constructor to the method's output.
-     *
-     * @return string representation of this {@code BigDecimal}, using
-     *         engineering notation if an exponent is needed.
-     * @since  1.5
-     */
-    public String toEngineeringString() {
-        return layoutChars(false);
-    }
-
-    /**
-     * Returns a string representation of this {@code BigDecimal}
-     * without an exponent field.  For values with a positive scale,
-     * the number of digits to the right of the decimal point is used
-     * to indicate scale.  For values with a zero or negative scale,
-     * the resulting string is generated as if the value were
-     * converted to a numerically equal value with zero scale and as
-     * if all the trailing zeros of the zero scale value were present
-     * in the result.
-     *
-     * The entire string is prefixed by a minus sign character '-'
-     * (<tt>'&#92;u002D'</tt>) if the unscaled value is less than
-     * zero. No sign character is prefixed if the unscaled value is
-     * zero or positive.
-     *
-     * Note that if the result of this method is passed to the
-     * {@linkplain #BigDecimal(String) string constructor}, only the
-     * numerical value of this {@code BigDecimal} will necessarily be
-     * recovered; the representation of the new {@code BigDecimal}
-     * may have a different scale.  In particular, if this
-     * {@code BigDecimal} has a negative scale, the string resulting
-     * from this method will have a scale of zero when processed by
-     * the string constructor.
-     *
-     * (This method behaves analogously to the {@code toString}
-     * method in 1.4 and earlier releases.)
-     *
-     * @return a string representation of this {@code BigDecimal}
-     * without an exponent field.
-     * @since 1.5
-     * @see #toString()
-     * @see #toEngineeringString()
-     */
-    public String toPlainString() {
-        BigDecimal bd = this;
-        if (bd.scale < 0)
-            bd = bd.setScale(0);
-        bd.inflate();
-        if (bd.scale == 0)      // No decimal point
-            return bd.intVal.toString();
-        return bd.getValueString(bd.signum(), bd.intVal.abs().toString(), bd.scale);
-    }
-
-    /* Returns a digit.digit string */
-    private String getValueString(int signum, String intString, int scale) {
-        /* Insert decimal point */
-        StringBuilder buf;
-        int insertionPoint = intString.length() - scale;
-        if (insertionPoint == 0) {  /* Point goes right before intVal */
-            return (signum<0 ? "-0." : "0.") + intString;
-        } else if (insertionPoint > 0) { /* Point goes inside intVal */
-            buf = new StringBuilder(intString);
-            buf.insert(insertionPoint, '.');
-            if (signum < 0)
-                buf.insert(0, '-');
-        } else { /* We must insert zeros between point and intVal */
-            buf = new StringBuilder(3-insertionPoint + intString.length());
-            buf.append(signum<0 ? "-0." : "0.");
-            for (int i=0; i<-insertionPoint; i++)
-                buf.append('0');
-            buf.append(intString);
-        }
-        return buf.toString();
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to a {@code BigInteger}.
-     * This conversion is analogous to the
-     * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code long} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * any fractional part of this
-     * {@code BigDecimal} will be discarded.  Note that this
-     * conversion can lose information about the precision of the
-     * {@code BigDecimal} value.
-     * <p>
-     * To have an exception thrown if the conversion is inexact (in
-     * other words if a nonzero fractional part is discarded), use the
-     * {@link #toBigIntegerExact()} method.
-     *
-     * @return this {@code BigDecimal} converted to a {@code BigInteger}.
-     */
-    public BigInteger toBigInteger() {
-        // force to an integer, quietly
-        return this.setScale(0, ROUND_DOWN).inflate();
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to a {@code BigInteger},
-     * checking for lost information.  An exception is thrown if this
-     * {@code BigDecimal} has a nonzero fractional part.
-     *
-     * @return this {@code BigDecimal} converted to a {@code BigInteger}.
-     * @throws ArithmeticException if {@code this} has a nonzero
-     *         fractional part.
-     * @since  1.5
-     */
-    public BigInteger toBigIntegerExact() {
-        // round to an integer, with Exception if decimal part non-0
-        return this.setScale(0, ROUND_UNNECESSARY).inflate();
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to a {@code long}.
-     * This conversion is analogous to the
-     * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code short} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * any fractional part of this
-     * {@code BigDecimal} will be discarded, and if the resulting
-     * "{@code BigInteger}" is too big to fit in a
-     * {@code long}, only the low-order 64 bits are returned.
-     * Note that this conversion can lose information about the
-     * overall magnitude and precision of this {@code BigDecimal} value as well
-     * as return a result with the opposite sign.
-     *
-     * @return this {@code BigDecimal} converted to a {@code long}.
-     */
-    public long longValue(){
-        return (intCompact != INFLATED && scale == 0) ?
-            intCompact:
-            toBigInteger().longValue();
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to a {@code long}, checking
-     * for lost information.  If this {@code BigDecimal} has a
-     * nonzero fractional part or is out of the possible range for a
-     * {@code long} result then an {@code ArithmeticException} is
-     * thrown.
-     *
-     * @return this {@code BigDecimal} converted to a {@code long}.
-     * @throws ArithmeticException if {@code this} has a nonzero
-     *         fractional part, or will not fit in a {@code long}.
-     * @since  1.5
-     */
-    public long longValueExact() {
-        if (intCompact != INFLATED && scale == 0)
-            return intCompact;
-        // If more than 19 digits in integer part it cannot possibly fit
-        if ((precision() - scale) > 19) // [OK for negative scale too]
-            throw new java.lang.ArithmeticException("Overflow");
-        // Fastpath zero and < 1.0 numbers (the latter can be very slow
-        // to round if very small)
-        if (this.signum() == 0)
-            return 0;
-        if ((this.precision() - this.scale) <= 0)
-            throw new ArithmeticException("Rounding necessary");
-        // round to an integer, with Exception if decimal part non-0
-        BigDecimal num = this.setScale(0, ROUND_UNNECESSARY);
-        if (num.precision() >= 19) // need to check carefully
-            LongOverflow.check(num);
-        return num.inflate().longValue();
-    }
-
-    private static class LongOverflow {
-        /** BigInteger equal to Long.MIN_VALUE. */
-        private static final BigInteger LONGMIN = BigInteger.valueOf(Long.MIN_VALUE);
-
-        /** BigInteger equal to Long.MAX_VALUE. */
-        private static final BigInteger LONGMAX = BigInteger.valueOf(Long.MAX_VALUE);
-
-        public static void check(BigDecimal num) {
-            num.inflate();
-            if ((num.intVal.compareTo(LONGMIN) < 0) ||
-                (num.intVal.compareTo(LONGMAX) > 0))
-                throw new java.lang.ArithmeticException("Overflow");
-        }
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to an {@code int}.
-     * This conversion is analogous to the
-     * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code short} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * any fractional part of this
-     * {@code BigDecimal} will be discarded, and if the resulting
-     * "{@code BigInteger}" is too big to fit in an
-     * {@code int}, only the low-order 32 bits are returned.
-     * Note that this conversion can lose information about the
-     * overall magnitude and precision of this {@code BigDecimal}
-     * value as well as return a result with the opposite sign.
-     *
-     * @return this {@code BigDecimal} converted to an {@code int}.
-     */
-    public int intValue() {
-        return  (intCompact != INFLATED && scale == 0) ?
-            (int)intCompact :
-            toBigInteger().intValue();
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to an {@code int}, checking
-     * for lost information.  If this {@code BigDecimal} has a
-     * nonzero fractional part or is out of the possible range for an
-     * {@code int} result then an {@code ArithmeticException} is
-     * thrown.
-     *
-     * @return this {@code BigDecimal} converted to an {@code int}.
-     * @throws ArithmeticException if {@code this} has a nonzero
-     *         fractional part, or will not fit in an {@code int}.
-     * @since  1.5
-     */
-    public int intValueExact() {
-       long num;
-       num = this.longValueExact();     // will check decimal part
-       if ((int)num != num)
-           throw new java.lang.ArithmeticException("Overflow");
-       return (int)num;
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to a {@code short}, checking
-     * for lost information.  If this {@code BigDecimal} has a
-     * nonzero fractional part or is out of the possible range for a
-     * {@code short} result then an {@code ArithmeticException} is
-     * thrown.
-     *
-     * @return this {@code BigDecimal} converted to a {@code short}.
-     * @throws ArithmeticException if {@code this} has a nonzero
-     *         fractional part, or will not fit in a {@code short}.
-     * @since  1.5
-     */
-    public short shortValueExact() {
-       long num;
-       num = this.longValueExact();     // will check decimal part
-       if ((short)num != num)
-           throw new java.lang.ArithmeticException("Overflow");
-       return (short)num;
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to a {@code byte}, checking
-     * for lost information.  If this {@code BigDecimal} has a
-     * nonzero fractional part or is out of the possible range for a
-     * {@code byte} result then an {@code ArithmeticException} is
-     * thrown.
-     *
-     * @return this {@code BigDecimal} converted to a {@code byte}.
-     * @throws ArithmeticException if {@code this} has a nonzero
-     *         fractional part, or will not fit in a {@code byte}.
-     * @since  1.5
-     */
-    public byte byteValueExact() {
-       long num;
-       num = this.longValueExact();     // will check decimal part
-       if ((byte)num != num)
-           throw new java.lang.ArithmeticException("Overflow");
-       return (byte)num;
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to a {@code float}.
-     * This conversion is similar to the
-     * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * if this {@code BigDecimal} has too great a
-     * magnitude to represent as a {@code float}, it will be
-     * converted to {@link Float#NEGATIVE_INFINITY} or {@link
-     * Float#POSITIVE_INFINITY} as appropriate.  Note that even when
-     * the return value is finite, this conversion can lose
-     * information about the precision of the {@code BigDecimal}
-     * value.
-     *
-     * @return this {@code BigDecimal} converted to a {@code float}.
-     */
-    public float floatValue(){
-        if (scale == 0 && intCompact != INFLATED)
-                return (float)intCompact;
-        // Somewhat inefficient, but guaranteed to work.
-        return Float.parseFloat(this.toString());
-    }
-
-    /**
-     * Converts this {@code BigDecimal} to a {@code double}.
-     * This conversion is similar to the
-     * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * if this {@code BigDecimal} has too great a
-     * magnitude represent as a {@code double}, it will be
-     * converted to {@link Double#NEGATIVE_INFINITY} or {@link
-     * Double#POSITIVE_INFINITY} as appropriate.  Note that even when
-     * the return value is finite, this conversion can lose
-     * information about the precision of the {@code BigDecimal}
-     * value.
-     *
-     * @return this {@code BigDecimal} converted to a {@code double}.
-     */
-    public double doubleValue(){
-        if (scale == 0 && intCompact != INFLATED)
-            return (double)intCompact;
-        // Somewhat inefficient, but guaranteed to work.
-        return Double.parseDouble(this.toString());
-    }
-
-    /**
-     * Returns the size of an ulp, a unit in the last place, of this
-     * {@code BigDecimal}.  An ulp of a nonzero {@code BigDecimal}
-     * value is the positive distance between this value and the
-     * {@code BigDecimal} value next larger in magnitude with the
-     * same number of digits.  An ulp of a zero value is numerically
-     * equal to 1 with the scale of {@code this}.  The result is
-     * stored with the same scale as {@code this} so the result
-     * for zero and nonzero values is equal to {@code [1,
-     * this.scale()]}.
-     *
-     * @return the size of an ulp of {@code this}
-     * @since 1.5
-     */
-    public BigDecimal ulp() {
-        return BigDecimal.valueOf(1, this.scale());
-    }
-
-
-    // Private class to build a string representation for BigDecimal object.
-    // "StringBuilderHelper" is constructed as a thread local variable so it is
-    // thread safe. The StringBuilder field acts as a buffer to hold the temporary
-    // representation of BigDecimal. The cmpCharArray holds all the characters for
-    // the compact representation of BigDecimal (except for '-' sign' if it is
-    // negative) if its intCompact field is not INFLATED. It is shared by all
-    // calls to toString() and its variants in that particular thread.
-    static class StringBuilderHelper {
-        final StringBuilder sb;    // Placeholder for BigDecimal string
-        final char[] cmpCharArray; // character array to place the intCompact
-
-        StringBuilderHelper() {
-            sb = new StringBuilder();
-            // All non negative longs can be made to fit into 19 character array.
-            cmpCharArray = new char[19];
-        }
-
-        // Accessors.
-        StringBuilder getStringBuilder() {
-            sb.setLength(0);
-            return sb;
-        }
-
-        char[] getCompactCharArray() {
-            return cmpCharArray;
-        }
-
-        /**
-         * Places characters representing the intCompact in {@code long} into
-         * cmpCharArray and returns the offset to the array where the
-         * representation starts.
-         *
-         * @param intCompact the number to put into the cmpCharArray.
-         * @return offset to the array where the representation starts.
-         * Note: intCompact must be greater or equal to zero.
-         */
-        int putIntCompact(long intCompact) {
-            assert intCompact >= 0;
-
-            long q;
-            int r;
-            // since we start from the least significant digit, charPos points to
-            // the last character in cmpCharArray.
-            int charPos = cmpCharArray.length;
-
-            // Get 2 digits/iteration using longs until quotient fits into an int
-            while (intCompact > Integer.MAX_VALUE) {
-                q = intCompact / 100;
-                r = (int)(intCompact - q * 100);
-                intCompact = q;
-                cmpCharArray[--charPos] = DIGIT_ONES[r];
-                cmpCharArray[--charPos] = DIGIT_TENS[r];
-            }
-
-            // Get 2 digits/iteration using ints when i2 >= 100
-            int q2;
-            int i2 = (int)intCompact;
-            while (i2 >= 100) {
-                q2 = i2 / 100;
-                r  = i2 - q2 * 100;
-                i2 = q2;
-                cmpCharArray[--charPos] = DIGIT_ONES[r];
-                cmpCharArray[--charPos] = DIGIT_TENS[r];
-            }
-
-            cmpCharArray[--charPos] = DIGIT_ONES[i2];
-            if (i2 >= 10)
-                cmpCharArray[--charPos] = DIGIT_TENS[i2];
-
-            return charPos;
-        }
-
-        final static char[] DIGIT_TENS = {
-            '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
-            '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
-            '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
-            '3', '3', '3', '3', '3', '3', '3', '3', '3', '3',
-            '4', '4', '4', '4', '4', '4', '4', '4', '4', '4',
-            '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
-            '6', '6', '6', '6', '6', '6', '6', '6', '6', '6',
-            '7', '7', '7', '7', '7', '7', '7', '7', '7', '7',
-            '8', '8', '8', '8', '8', '8', '8', '8', '8', '8',
-            '9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
-        };
-
-        final static char[] DIGIT_ONES = {
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-        };
-    }
-
-    /**
-     * Lay out this {@code BigDecimal} into a {@code char[]} array.
-     * The Java 1.2 equivalent to this was called {@code getValueString}.
-     *
-     * @param  sci {@code true} for Scientific exponential notation;
-     *          {@code false} for Engineering
-     * @return string with canonical string representation of this
-     *         {@code BigDecimal}
-     */
-    private String layoutChars(boolean sci) {
-        if (scale == 0)                      // zero scale is trivial
-            return (intCompact != INFLATED) ?
-                Long.toString(intCompact):
-                intVal.toString();
-
-        StringBuilderHelper sbHelper = threadLocalStringBuilderHelper.get();
-        char[] coeff;
-        int offset;  // offset is the starting index for coeff array
-        // Get the significand as an absolute value
-        if (intCompact != INFLATED) {
-            offset = sbHelper.putIntCompact(Math.abs(intCompact));
-            coeff  = sbHelper.getCompactCharArray();
-        } else {
-            offset = 0;
-            coeff  = intVal.abs().toString().toCharArray();
-        }
-
-        // Construct a buffer, with sufficient capacity for all cases.
-        // If E-notation is needed, length will be: +1 if negative, +1
-        // if '.' needed, +2 for "E+", + up to 10 for adjusted exponent.
-        // Otherwise it could have +1 if negative, plus leading "0.00000"
-        StringBuilder buf = sbHelper.getStringBuilder();
-        if (signum() < 0)             // prefix '-' if negative
-            buf.append('-');
-        int coeffLen = coeff.length - offset;
-        long adjusted = -(long)scale + (coeffLen -1);
-        if ((scale >= 0) && (adjusted >= -6)) { // plain number
-            int pad = scale - coeffLen;         // count of padding zeros
-            if (pad >= 0) {                     // 0.xxx form
-                buf.append('0');
-                buf.append('.');
-                for (; pad>0; pad--) {
-                    buf.append('0');
-                }
-                buf.append(coeff, offset, coeffLen);
-            } else {                         // xx.xx form
-                buf.append(coeff, offset, -pad);
-                buf.append('.');
-                buf.append(coeff, -pad + offset, scale);
-            }
-        } else { // E-notation is needed
-            if (sci) {                       // Scientific notation
-                buf.append(coeff[offset]);   // first character
-                if (coeffLen > 1) {          // more to come
-                    buf.append('.');
-                    buf.append(coeff, offset + 1, coeffLen - 1);
-                }
-            } else {                         // Engineering notation
-                int sig = (int)(adjusted % 3);
-                if (sig < 0)
-                    sig += 3;                // [adjusted was negative]
-                adjusted -= sig;             // now a multiple of 3
-                sig++;
-                if (signum() == 0) {
-                    switch (sig) {
-                    case 1:
-                        buf.append('0'); // exponent is a multiple of three
-                        break;
-                    case 2:
-                        buf.append("0.00");
-                        adjusted += 3;
-                        break;
-                    case 3:
-                        buf.append("0.0");
-                        adjusted += 3;
-                        break;
-                    default:
-                        throw new AssertionError("Unexpected sig value " + sig);
-                    }
-                } else if (sig >= coeffLen) {   // significand all in integer
-                    buf.append(coeff, offset, coeffLen);
-                    // may need some zeros, too
-                    for (int i = sig - coeffLen; i > 0; i--)
-                        buf.append('0');
-                } else {                     // xx.xxE form
-                    buf.append(coeff, offset, sig);
-                    buf.append('.');
-                    buf.append(coeff, offset + sig, coeffLen - sig);
-                }
-            }
-            if (adjusted != 0) {             // [!sci could have made 0]
-                buf.append('E');
-                if (adjusted > 0)            // force sign for positive
-                    buf.append('+');
-                buf.append(adjusted);
-            }
-        }
-        return buf.toString();
-    }
-
-    /**
-     * Return 10 to the power n, as a {@code BigInteger}.
-     *
-     * @param  n the power of ten to be returned (>=0)
-     * @return a {@code BigInteger} with the value (10<sup>n</sup>)
-     */
-    private static BigInteger bigTenToThe(int n) {
-        if (n < 0)
-            return BigInteger.ZERO;
-
-        if (n < BIG_TEN_POWERS_TABLE_MAX) {
-            BigInteger[] pows = BIG_TEN_POWERS_TABLE;
-            if (n < pows.length)
-                return pows[n];
-            else
-                return expandBigIntegerTenPowers(n);
-        }
-        // BigInteger.pow is slow, so make 10**n by constructing a
-        // BigInteger from a character string (still not very fast)
-        char tenpow[] = new char[n + 1];
-        tenpow[0] = '1';
-        for (int i = 1; i <= n; i++)
-            tenpow[i] = '0';
-        return new BigInteger(tenpow);
-    }
-
-    /**
-     * Expand the BIG_TEN_POWERS_TABLE array to contain at least 10**n.
-     *
-     * @param n the power of ten to be returned (>=0)
-     * @return a {@code BigDecimal} with the value (10<sup>n</sup>) and
-     *         in the meantime, the BIG_TEN_POWERS_TABLE array gets
-     *         expanded to the size greater than n.
-     */
-    private static BigInteger expandBigIntegerTenPowers(int n) {
-        synchronized(BigDecimal.class) {
-            BigInteger[] pows = BIG_TEN_POWERS_TABLE;
-            int curLen = pows.length;
-            // The following comparison and the above synchronized statement is
-            // to prevent multiple threads from expanding the same array.
-            if (curLen <= n) {
-                int newLen = curLen << 1;
-                while (newLen <= n)
-                    newLen <<= 1;
-                pows = Arrays.copyOf(pows, newLen);
-                for (int i = curLen; i < newLen; i++)
-                    pows[i] = pows[i - 1].multiply(BigInteger.TEN);
-                // Based on the following facts:
-                // 1. pows is a private local varible;
-                // 2. the following store is a volatile store.
-                // the newly created array elements can be safely published.
-                BIG_TEN_POWERS_TABLE = pows;
-            }
-            return pows[n];
-        }
-    }
-
-    private static final long[] LONG_TEN_POWERS_TABLE = {
-        1,                     // 0 / 10^0
-        10,                    // 1 / 10^1
-        100,                   // 2 / 10^2
-        1000,                  // 3 / 10^3
-        10000,                 // 4 / 10^4
-        100000,                // 5 / 10^5
-        1000000,               // 6 / 10^6
-        10000000,              // 7 / 10^7
-        100000000,             // 8 / 10^8
-        1000000000,            // 9 / 10^9
-        10000000000L,          // 10 / 10^10
-        100000000000L,         // 11 / 10^11
-        1000000000000L,        // 12 / 10^12
-        10000000000000L,       // 13 / 10^13
-        100000000000000L,      // 14 / 10^14
-        1000000000000000L,     // 15 / 10^15
-        10000000000000000L,    // 16 / 10^16
-        100000000000000000L,   // 17 / 10^17
-        1000000000000000000L   // 18 / 10^18
-    };
-
-    private static volatile BigInteger BIG_TEN_POWERS_TABLE[] = {BigInteger.ONE,
-        BigInteger.valueOf(10),       BigInteger.valueOf(100),
-        BigInteger.valueOf(1000),     BigInteger.valueOf(10000),
-        BigInteger.valueOf(100000),   BigInteger.valueOf(1000000),
-        BigInteger.valueOf(10000000), BigInteger.valueOf(100000000),
-        BigInteger.valueOf(1000000000),
-        BigInteger.valueOf(10000000000L),
-        BigInteger.valueOf(100000000000L),
-        BigInteger.valueOf(1000000000000L),
-        BigInteger.valueOf(10000000000000L),
-        BigInteger.valueOf(100000000000000L),
-        BigInteger.valueOf(1000000000000000L),
-        BigInteger.valueOf(10000000000000000L),
-        BigInteger.valueOf(100000000000000000L),
-        BigInteger.valueOf(1000000000000000000L)
-    };
-
-    private static final int BIG_TEN_POWERS_TABLE_INITLEN =
-        BIG_TEN_POWERS_TABLE.length;
-    private static final int BIG_TEN_POWERS_TABLE_MAX =
-        16 * BIG_TEN_POWERS_TABLE_INITLEN;
-
-    private static final long THRESHOLDS_TABLE[] = {
-        Long.MAX_VALUE,                     // 0
-        Long.MAX_VALUE/10L,                 // 1
-        Long.MAX_VALUE/100L,                // 2
-        Long.MAX_VALUE/1000L,               // 3
-        Long.MAX_VALUE/10000L,              // 4
-        Long.MAX_VALUE/100000L,             // 5
-        Long.MAX_VALUE/1000000L,            // 6
-        Long.MAX_VALUE/10000000L,           // 7
-        Long.MAX_VALUE/100000000L,          // 8
-        Long.MAX_VALUE/1000000000L,         // 9
-        Long.MAX_VALUE/10000000000L,        // 10
-        Long.MAX_VALUE/100000000000L,       // 11
-        Long.MAX_VALUE/1000000000000L,      // 12
-        Long.MAX_VALUE/10000000000000L,     // 13
-        Long.MAX_VALUE/100000000000000L,    // 14
-        Long.MAX_VALUE/1000000000000000L,   // 15
-        Long.MAX_VALUE/10000000000000000L,  // 16
-        Long.MAX_VALUE/100000000000000000L, // 17
-        Long.MAX_VALUE/1000000000000000000L // 18
-    };
-
-    /**
-     * Compute val * 10 ^ n; return this product if it is
-     * representable as a long, INFLATED otherwise.
-     */
-    private static long longMultiplyPowerTen(long val, int n) {
-        if (val == 0 || n <= 0)
-            return val;
-        long[] tab = LONG_TEN_POWERS_TABLE;
-        long[] bounds = THRESHOLDS_TABLE;
-        if (n < tab.length && n < bounds.length) {
-            long tenpower = tab[n];
-            if (val == 1)
-                return tenpower;
-            if (Math.abs(val) <= bounds[n])
-                return val * tenpower;
-        }
-        return INFLATED;
-    }
-
-    /**
-     * Compute this * 10 ^ n.
-     * Needed mainly to allow special casing to trap zero value
-     */
-    private BigInteger bigMultiplyPowerTen(int n) {
-        if (n <= 0)
-            return this.inflate();
-
-        if (intCompact != INFLATED)
-            return bigTenToThe(n).multiply(intCompact);
-        else
-            return intVal.multiply(bigTenToThe(n));
-    }
-
-    /**
-     * Assign appropriate BigInteger to intVal field if intVal is
-     * null, i.e. the compact representation is in use.
-     */
-    private BigInteger inflate() {
-        if (intVal == null)
-            intVal = BigInteger.valueOf(intCompact);
-        return intVal;
-    }
-
-    /**
-     * Match the scales of two {@code BigDecimal}s to align their
-     * least significant digits.
-     *
-     * <p>If the scales of val[0] and val[1] differ, rescale
-     * (non-destructively) the lower-scaled {@code BigDecimal} so
-     * they match.  That is, the lower-scaled reference will be
-     * replaced by a reference to a new object with the same scale as
-     * the other {@code BigDecimal}.
-     *
-     * @param  val array of two elements referring to the two
-     *         {@code BigDecimal}s to be aligned.
-     */
-    private static void matchScale(BigDecimal[] val) {
-        if (val[0].scale == val[1].scale) {
-            return;
-        } else if (val[0].scale < val[1].scale) {
-            val[0] = val[0].setScale(val[1].scale, ROUND_UNNECESSARY);
-        } else if (val[1].scale < val[0].scale) {
-            val[1] = val[1].setScale(val[0].scale, ROUND_UNNECESSARY);
-        }
-    }
-
-    /**
-     * Reconstitute the {@code BigDecimal} instance from a stream (that is,
-     * deserialize it).
-     *
-     * @param s the stream being read.
-     */
-    private void readObject(java.io.ObjectInputStream s)
-        throws java.io.IOException, ClassNotFoundException {
-        // Read in all fields
-        s.defaultReadObject();
-        // validate possibly bad fields
-        if (intVal == null) {
-            String message = "BigDecimal: null intVal in stream";
-            throw new java.io.StreamCorruptedException(message);
-        // [all values of scale are now allowed]
-        }
-        intCompact = compactValFor(intVal);
-    }
-
-   /**
-    * Serialize this {@code BigDecimal} to the stream in question
-    *
-    * @param s the stream to serialize to.
-    */
-   private void writeObject(java.io.ObjectOutputStream s)
-       throws java.io.IOException {
-       // Must inflate to maintain compatible serial form.
-       this.inflate();
-
-       // Write proper fields
-       s.defaultWriteObject();
-   }
-
-
-    /**
-     * Returns the length of the absolute value of a {@code long}, in decimal
-     * digits.
-     *
-     * @param x the {@code long}
-     * @return the length of the unscaled value, in deciaml digits.
-     */
-    private static int longDigitLength(long x) {
-        /*
-         * As described in "Bit Twiddling Hacks" by Sean Anderson,
-         * (http://graphics.stanford.edu/~seander/bithacks.html)
-         * integer log 10 of x is within 1 of
-         * (1233/4096)* (1 + integer log 2 of x).
-         * The fraction 1233/4096 approximates log10(2). So we first
-         * do a version of log2 (a variant of Long class with
-         * pre-checks and opposite directionality) and then scale and
-         * check against powers table. This is a little simpler in
-         * present context than the version in Hacker's Delight sec
-         * 11-4.  Adding one to bit length allows comparing downward
-         * from the LONG_TEN_POWERS_TABLE that we need anyway.
-         */
-        assert x != INFLATED;
-        if (x < 0)
-            x = -x;
-        if (x < 10) // must screen for 0, might as well 10
-            return 1;
-        int n = 64; // not 63, to avoid needing to add 1 later
-        int y = (int)(x >>> 32);
-        if (y == 0) { n -= 32; y = (int)x; }
-        if (y >>> 16 == 0) { n -= 16; y <<= 16; }
-        if (y >>> 24 == 0) { n -=  8; y <<=  8; }
-        if (y >>> 28 == 0) { n -=  4; y <<=  4; }
-        if (y >>> 30 == 0) { n -=  2; y <<=  2; }
-        int r = (((y >>> 31) + n) * 1233) >>> 12;
-        long[] tab = LONG_TEN_POWERS_TABLE;
-        // if r >= length, must have max possible digits for long
-        return (r >= tab.length || x < tab[r])? r : r+1;
-    }
-
-    /**
-     * Returns the length of the absolute value of a BigInteger, in
-     * decimal digits.
-     *
-     * @param b the BigInteger
-     * @return the length of the unscaled value, in decimal digits
-     */
-    private static int bigDigitLength(BigInteger b) {
-        /*
-         * Same idea as the long version, but we need a better
-         * approximation of log10(2). Using 646456993/2^31
-         * is accurate up to max possible reported bitLength.
-         */
-        if (b.signum == 0)
-            return 1;
-        int r = (int)((((long)b.bitLength() + 1) * 646456993) >>> 31);
-        return b.compareMagnitude(bigTenToThe(r)) < 0? r : r+1;
-    }
-
-
-    /**
-     * Remove insignificant trailing zeros from this
-     * {@code BigDecimal} until the preferred scale is reached or no
-     * more zeros can be removed.  If the preferred scale is less than
-     * Integer.MIN_VALUE, all the trailing zeros will be removed.
-     *
-     * {@code BigInteger} assistance could help, here?
-     *
-     * <p>WARNING: This method should only be called on new objects as
-     * it mutates the value fields.
-     *
-     * @return this {@code BigDecimal} with a scale possibly reduced
-     * to be closed to the preferred scale.
-     */
-    private BigDecimal stripZerosToMatchScale(long preferredScale) {
-        this.inflate();
-        BigInteger qr[];                // quotient-remainder pair
-        while ( intVal.compareMagnitude(BigInteger.TEN) >= 0 &&
-                scale > preferredScale) {
-            if (intVal.testBit(0))
-                break;                  // odd number cannot end in 0
-            qr = intVal.divideAndRemainder(BigInteger.TEN);
-            if (qr[1].signum() != 0)
-                break;                  // non-0 remainder
-            intVal=qr[0];
-            scale = checkScale((long)scale-1);  // could Overflow
-            if (precision > 0)          // adjust precision if known
-              precision--;
-        }
-        if (intVal != null)
-            intCompact = compactValFor(intVal);
-        return this;
-    }
-
-    /**
-     * Check a scale for Underflow or Overflow.  If this BigDecimal is
-     * nonzero, throw an exception if the scale is outof range. If this
-     * is zero, saturate the scale to the extreme value of the right
-     * sign if the scale is out of range.
-     *
-     * @param val The new scale.
-     * @throws ArithmeticException (overflow or underflow) if the new
-     *         scale is out of range.
-     * @return validated scale as an int.
-     */
-    private int checkScale(long val) {
-        int asInt = (int)val;
-        if (asInt != val) {
-            asInt = val>Integer.MAX_VALUE ? Integer.MAX_VALUE : Integer.MIN_VALUE;
-            BigInteger b;
-            if (intCompact != 0 &&
-                ((b = intVal) == null || b.signum() != 0))
-                throw new ArithmeticException(asInt>0 ? "Underflow":"Overflow");
-        }
-        return asInt;
-    }
-
-    /**
-     * Round an operand; used only if digits &gt; 0.  Does not change
-     * {@code this}; if rounding is needed a new {@code BigDecimal}
-     * is created and returned.
-     *
-     * @param mc the context to use.
-     * @throws ArithmeticException if the result is inexact but the
-     *         rounding mode is {@code UNNECESSARY}.
-     */
-    private BigDecimal roundOp(MathContext mc) {
-        BigDecimal rounded = doRound(this, mc);
-        return rounded;
-    }
-
-    /** Round this BigDecimal according to the MathContext settings;
-     *  used only if precision {@literal >} 0.
-     *
-     * <p>WARNING: This method should only be called on new objects as
-     * it mutates the value fields.
-     *
-     * @param mc the context to use.
-     * @throws ArithmeticException if the rounding mode is
-     *         {@code RoundingMode.UNNECESSARY} and the
-     *         {@code BigDecimal} operation would require rounding.
-     */
-    private void roundThis(MathContext mc) {
-        BigDecimal rounded = doRound(this, mc);
-        if (rounded == this)                 // wasn't rounded
-            return;
-        this.intVal     = rounded.intVal;
-        this.intCompact = rounded.intCompact;
-        this.scale      = rounded.scale;
-        this.precision  = rounded.precision;
-    }
-
-    /**
-     * Returns a {@code BigDecimal} rounded according to the
-     * MathContext settings; used only if {@code mc.precision > 0}.
-     * Does not change {@code this}; if rounding is needed a new
-     * {@code BigDecimal} is created and returned.
-     *
-     * @param mc the context to use.
-     * @return a {@code BigDecimal} rounded according to the MathContext
-     *         settings.  May return this, if no rounding needed.
-     * @throws ArithmeticException if the rounding mode is
-     *         {@code RoundingMode.UNNECESSARY} and the
-     *         result is inexact.
-     */
-    private static BigDecimal doRound(BigDecimal d, MathContext mc) {
-        int mcp = mc.precision;
-        int drop;
-        // This might (rarely) iterate to cover the 999=>1000 case
-        while ((drop = d.precision() - mcp) > 0) {
-            int newScale = d.checkScale((long)d.scale - drop);
-            int mode = mc.roundingMode.oldMode;
-            if (drop < LONG_TEN_POWERS_TABLE.length)
-                d = divideAndRound(d.intCompact, d.intVal,
-                                   LONG_TEN_POWERS_TABLE[drop], null,
-                                   newScale, mode, newScale);
-            else
-                d = divideAndRound(d.intCompact, d.intVal,
-                                   INFLATED, bigTenToThe(drop),
-                                   newScale, mode, newScale);
-        }
-        return d;
-    }
-
-    /**
-     * Returns the compact value for given {@code BigInteger}, or
-     * INFLATED if too big. Relies on internal representation of
-     * {@code BigInteger}.
-     */
-    private static long compactValFor(BigInteger b) {
-        int[] m = b.mag;
-        int len = m.length;
-        if (len == 0)
-            return 0;
-        int d = m[0];
-        if (len > 2 || (len == 2 && d < 0))
-            return INFLATED;
-
-        long u = (len == 2)?
-            (((long) m[1] & LONG_MASK) + (((long)d) << 32)) :
-            (((long)d)   & LONG_MASK);
-        return (b.signum < 0)? -u : u;
-    }
-
-    private static int longCompareMagnitude(long x, long y) {
-        if (x < 0)
-            x = -x;
-        if (y < 0)
-            y = -y;
-        return (x < y) ? -1 : ((x == y) ? 0 : 1);
-    }
-
-    private static int saturateLong(long s) {
-        int i = (int)s;
-        return (s == i) ? i : (s < 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE);
-    }
-
-    /*
-     * Internal printing routine
-     */
-    private static void print(String name, BigDecimal bd) {
-        System.err.format("%s:\tintCompact %d\tintVal %d\tscale %d\tprecision %d%n",
-                          name,
-                          bd.intCompact,
-                          bd.intVal,
-                          bd.scale,
-                          bd.precision);
-    }
-
-    /**
-     * Check internal invariants of this BigDecimal.  These invariants
-     * include:
-     *
-     * <ul>
-     *
-     * <li>The object must be initialized; either intCompact must not be
-     * INFLATED or intVal is non-null.  Both of these conditions may
-     * be true.
-     *
-     * <li>If both intCompact and intVal and set, their values must be
-     * consistent.
-     *
-     * <li>If precision is nonzero, it must have the right value.
-     * </ul>
-     *
-     * Note: Since this is an audit method, we are not supposed to change the
-     * state of this BigDecimal object.
-     */
-    private BigDecimal audit() {
-        if (intCompact == INFLATED) {
-            if (intVal == null) {
-                print("audit", this);
-                throw new AssertionError("null intVal");
-            }
-            // Check precision
-            if (precision > 0 && precision != bigDigitLength(intVal)) {
-                print("audit", this);
-                throw new AssertionError("precision mismatch");
-            }
-        } else {
-            if (intVal != null) {
-                long val = intVal.longValue();
-                if (val != intCompact) {
-                    print("audit", this);
-                    throw new AssertionError("Inconsistent state, intCompact=" +
-                                             intCompact + "\t intVal=" + val);
-                }
-            }
-            // Check precision
-            if (precision > 0 && precision != longDigitLength(intCompact)) {
-                print("audit", this);
-                throw new AssertionError("precision mismatch");
-            }
-        }
-        return this;
-    }
-}
diff --git a/ojluni/src/main/java/java/math/BigInteger.java b/ojluni/src/main/java/java/math/BigInteger.java
deleted file mode 100755
index 4fcce19..0000000
--- a/ojluni/src/main/java/java/math/BigInteger.java
+++ /dev/null
@@ -1,3186 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Portions Copyright (c) 1995  Colin Plumb.  All rights reserved.
- */
-
-package java.math;
-
-import java.util.Random;
-import java.io.*;
-
-/**
- * Immutable arbitrary-precision integers.  All operations behave as if
- * BigIntegers were represented in two's-complement notation (like Java's
- * primitive integer types).  BigInteger provides analogues to all of Java's
- * primitive integer operators, and all relevant methods from java.lang.Math.
- * Additionally, BigInteger provides operations for modular arithmetic, GCD
- * calculation, primality testing, prime generation, bit manipulation,
- * and a few other miscellaneous operations.
- *
- * <p>Semantics of arithmetic operations exactly mimic those of Java's integer
- * arithmetic operators, as defined in <i>The Java Language Specification</i>.
- * For example, division by zero throws an {@code ArithmeticException}, and
- * division of a negative by a positive yields a negative (or zero) remainder.
- * All of the details in the Spec concerning overflow are ignored, as
- * BigIntegers are made as large as necessary to accommodate the results of an
- * operation.
- *
- * <p>Semantics of shift operations extend those of Java's shift operators
- * to allow for negative shift distances.  A right-shift with a negative
- * shift distance results in a left shift, and vice-versa.  The unsigned
- * right shift operator ({@code >>>}) is omitted, as this operation makes
- * little sense in combination with the "infinite word size" abstraction
- * provided by this class.
- *
- * <p>Semantics of bitwise logical operations exactly mimic those of Java's
- * bitwise integer operators.  The binary operators ({@code and},
- * {@code or}, {@code xor}) implicitly perform sign extension on the shorter
- * of the two operands prior to performing the operation.
- *
- * <p>Comparison operations perform signed integer comparisons, analogous to
- * those performed by Java's relational and equality operators.
- *
- * <p>Modular arithmetic operations are provided to compute residues, perform
- * exponentiation, and compute multiplicative inverses.  These methods always
- * return a non-negative result, between {@code 0} and {@code (modulus - 1)},
- * inclusive.
- *
- * <p>Bit operations operate on a single bit of the two's-complement
- * representation of their operand.  If necessary, the operand is sign-
- * extended so that it contains the designated bit.  None of the single-bit
- * operations can produce a BigInteger with a different sign from the
- * BigInteger being operated on, as they affect only a single bit, and the
- * "infinite word size" abstraction provided by this class ensures that there
- * are infinitely many "virtual sign bits" preceding each BigInteger.
- *
- * <p>For the sake of brevity and clarity, pseudo-code is used throughout the
- * descriptions of BigInteger methods.  The pseudo-code expression
- * {@code (i + j)} is shorthand for "a BigInteger whose value is
- * that of the BigInteger {@code i} plus that of the BigInteger {@code j}."
- * The pseudo-code expression {@code (i == j)} is shorthand for
- * "{@code true} if and only if the BigInteger {@code i} represents the same
- * value as the BigInteger {@code j}."  Other pseudo-code expressions are
- * interpreted similarly.
- *
- * <p>All methods and constructors in this class throw
- * {@code NullPointerException} when passed
- * a null object reference for any input parameter.
- *
- * @see     BigDecimal
- * @author  Josh Bloch
- * @author  Michael McCloskey
- * @since JDK1.1
- */
-
-public class BigInteger extends Number implements Comparable<BigInteger> {
-    /**
-     * The signum of this BigInteger: -1 for negative, 0 for zero, or
-     * 1 for positive.  Note that the BigInteger zero <i>must</i> have
-     * a signum of 0.  This is necessary to ensures that there is exactly one
-     * representation for each BigInteger value.
-     *
-     * @serial
-     */
-    final int signum;
-
-    /**
-     * The magnitude of this BigInteger, in <i>big-endian</i> order: the
-     * zeroth element of this array is the most-significant int of the
-     * magnitude.  The magnitude must be "minimal" in that the most-significant
-     * int ({@code mag[0]}) must be non-zero.  This is necessary to
-     * ensure that there is exactly one representation for each BigInteger
-     * value.  Note that this implies that the BigInteger zero has a
-     * zero-length mag array.
-     */
-    final int[] mag;
-
-    // These "redundant fields" are initialized with recognizable nonsense
-    // values, and cached the first time they are needed (or never, if they
-    // aren't needed).
-
-     /**
-     * One plus the bitCount of this BigInteger. Zeros means unitialized.
-     *
-     * @serial
-     * @see #bitCount
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
-     */
-    @Deprecated
-    private int bitCount;
-
-    /**
-     * One plus the bitLength of this BigInteger. Zeros means unitialized.
-     * (either value is acceptable).
-     *
-     * @serial
-     * @see #bitLength()
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
-     */
-    @Deprecated
-    private int bitLength;
-
-    /**
-     * Two plus the lowest set bit of this BigInteger, as returned by
-     * getLowestSetBit().
-     *
-     * @serial
-     * @see #getLowestSetBit
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
-     */
-    @Deprecated
-    private int lowestSetBit;
-
-    /**
-     * Two plus the index of the lowest-order int in the magnitude of this
-     * BigInteger that contains a nonzero int, or -2 (either value is acceptable).
-     * The least significant int has int-number 0, the next int in order of
-     * increasing significance has int-number 1, and so forth.
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
-     */
-    @Deprecated
-    private int firstNonzeroIntNum;
-
-    /**
-     * This mask is used to obtain the value of an int as if it were unsigned.
-     */
-    final static long LONG_MASK = 0xffffffffL;
-
-    //Constructors
-
-    /**
-     * Translates a byte array containing the two's-complement binary
-     * representation of a BigInteger into a BigInteger.  The input array is
-     * assumed to be in <i>big-endian</i> byte-order: the most significant
-     * byte is in the zeroth element.
-     *
-     * @param  val big-endian two's-complement binary representation of
-     *         BigInteger.
-     * @throws NumberFormatException {@code val} is zero bytes long.
-     */
-    public BigInteger(byte[] val) {
-        if (val.length == 0)
-            throw new NumberFormatException("Zero length BigInteger");
-
-        if (val[0] < 0) {
-            mag = makePositive(val);
-            signum = -1;
-        } else {
-            mag = stripLeadingZeroBytes(val);
-            signum = (mag.length == 0 ? 0 : 1);
-        }
-    }
-
-    /**
-     * This private constructor translates an int array containing the
-     * two's-complement binary representation of a BigInteger into a
-     * BigInteger. The input array is assumed to be in <i>big-endian</i>
-     * int-order: the most significant int is in the zeroth element.
-     */
-    private BigInteger(int[] val) {
-        if (val.length == 0)
-            throw new NumberFormatException("Zero length BigInteger");
-
-        if (val[0] < 0) {
-            mag = makePositive(val);
-            signum = -1;
-        } else {
-            mag = trustedStripLeadingZeroInts(val);
-            signum = (mag.length == 0 ? 0 : 1);
-        }
-    }
-
-    /**
-     * Translates the sign-magnitude representation of a BigInteger into a
-     * BigInteger.  The sign is represented as an integer signum value: -1 for
-     * negative, 0 for zero, or 1 for positive.  The magnitude is a byte array
-     * in <i>big-endian</i> byte-order: the most significant byte is in the
-     * zeroth element.  A zero-length magnitude array is permissible, and will
-     * result in a BigInteger value of 0, whether signum is -1, 0 or 1.
-     *
-     * @param  signum signum of the number (-1 for negative, 0 for zero, 1
-     *         for positive).
-     * @param  magnitude big-endian binary representation of the magnitude of
-     *         the number.
-     * @throws NumberFormatException {@code signum} is not one of the three
-     *         legal values (-1, 0, and 1), or {@code signum} is 0 and
-     *         {@code magnitude} contains one or more non-zero bytes.
-     */
-    public BigInteger(int signum, byte[] magnitude) {
-        this.mag = stripLeadingZeroBytes(magnitude);
-
-        if (signum < -1 || signum > 1)
-            throw(new NumberFormatException("Invalid signum value"));
-
-        if (this.mag.length==0) {
-            this.signum = 0;
-        } else {
-            if (signum == 0)
-                throw(new NumberFormatException("signum-magnitude mismatch"));
-            this.signum = signum;
-        }
-    }
-
-    /**
-     * A constructor for internal use that translates the sign-magnitude
-     * representation of a BigInteger into a BigInteger. It checks the
-     * arguments and copies the magnitude so this constructor would be
-     * safe for external use.
-     */
-    private BigInteger(int signum, int[] magnitude) {
-        this.mag = stripLeadingZeroInts(magnitude);
-
-        if (signum < -1 || signum > 1)
-            throw(new NumberFormatException("Invalid signum value"));
-
-        if (this.mag.length==0) {
-            this.signum = 0;
-        } else {
-            if (signum == 0)
-                throw(new NumberFormatException("signum-magnitude mismatch"));
-            this.signum = signum;
-        }
-    }
-
-    /**
-     * Translates the String representation of a BigInteger in the
-     * specified radix into a BigInteger.  The String representation
-     * consists of an optional minus or plus sign followed by a
-     * sequence of one or more digits in the specified radix.  The
-     * character-to-digit mapping is provided by {@code
-     * Character.digit}.  The String may not contain any extraneous
-     * characters (whitespace, for example).
-     *
-     * @param val String representation of BigInteger.
-     * @param radix radix to be used in interpreting {@code val}.
-     * @throws NumberFormatException {@code val} is not a valid representation
-     *         of a BigInteger in the specified radix, or {@code radix} is
-     *         outside the range from {@link Character#MIN_RADIX} to
-     *         {@link Character#MAX_RADIX}, inclusive.
-     * @see    Character#digit
-     */
-    public BigInteger(String val, int radix) {
-        int cursor = 0, numDigits;
-        final int len = val.length();
-
-        if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
-            throw new NumberFormatException("Radix out of range");
-        if (len == 0)
-            throw new NumberFormatException("Zero length BigInteger");
-
-        // Check for at most one leading sign
-        int sign = 1;
-        int index1 = val.lastIndexOf('-');
-        int index2 = val.lastIndexOf('+');
-        if ((index1 + index2) <= -1) {
-            // No leading sign character or at most one leading sign character
-            if (index1 == 0 || index2 == 0) {
-                cursor = 1;
-                if (len == 1)
-                    throw new NumberFormatException("Zero length BigInteger");
-            }
-            if (index1 == 0)
-                sign = -1;
-        } else
-            throw new NumberFormatException("Illegal embedded sign character");
-
-        // Skip leading zeros and compute number of digits in magnitude
-        while (cursor < len &&
-               Character.digit(val.charAt(cursor), radix) == 0)
-            cursor++;
-        if (cursor == len) {
-            signum = 0;
-            mag = ZERO.mag;
-            return;
-        }
-
-        numDigits = len - cursor;
-        signum = sign;
-
-        // Pre-allocate array of expected size. May be too large but can
-        // never be too small. Typically exact.
-        int numBits = (int)(((numDigits * bitsPerDigit[radix]) >>> 10) + 1);
-        int numWords = (numBits + 31) >>> 5;
-        int[] magnitude = new int[numWords];
-
-        // Process first (potentially short) digit group
-        int firstGroupLen = numDigits % digitsPerInt[radix];
-        if (firstGroupLen == 0)
-            firstGroupLen = digitsPerInt[radix];
-        String group = val.substring(cursor, cursor += firstGroupLen);
-        magnitude[numWords - 1] = Integer.parseInt(group, radix);
-        if (magnitude[numWords - 1] < 0)
-            throw new NumberFormatException("Illegal digit");
-
-        // Process remaining digit groups
-        int superRadix = intRadix[radix];
-        int groupVal = 0;
-        while (cursor < len) {
-            group = val.substring(cursor, cursor += digitsPerInt[radix]);
-            groupVal = Integer.parseInt(group, radix);
-            if (groupVal < 0)
-                throw new NumberFormatException("Illegal digit");
-            destructiveMulAdd(magnitude, superRadix, groupVal);
-        }
-        // Required for cases where the array was overallocated.
-        mag = trustedStripLeadingZeroInts(magnitude);
-    }
-
-    // Constructs a new BigInteger using a char array with radix=10
-    BigInteger(char[] val) {
-        int cursor = 0, numDigits;
-        int len = val.length;
-
-        // Check for leading minus sign
-        int sign = 1;
-        if (val[0] == '-') {
-            if (len == 1)
-                throw new NumberFormatException("Zero length BigInteger");
-            sign = -1;
-            cursor = 1;
-        } else if (val[0] == '+') {
-            if (len == 1)
-                throw new NumberFormatException("Zero length BigInteger");
-            cursor = 1;
-        }
-
-        // Skip leading zeros and compute number of digits in magnitude
-        while (cursor < len && Character.digit(val[cursor], 10) == 0)
-            cursor++;
-        if (cursor == len) {
-            signum = 0;
-            mag = ZERO.mag;
-            return;
-        }
-
-        numDigits = len - cursor;
-        signum = sign;
-
-        // Pre-allocate array of expected size
-        int numWords;
-        if (len < 10) {
-            numWords = 1;
-        } else {
-            int numBits = (int)(((numDigits * bitsPerDigit[10]) >>> 10) + 1);
-            numWords = (numBits + 31) >>> 5;
-        }
-        int[] magnitude = new int[numWords];
-
-        // Process first (potentially short) digit group
-        int firstGroupLen = numDigits % digitsPerInt[10];
-        if (firstGroupLen == 0)
-            firstGroupLen = digitsPerInt[10];
-        magnitude[numWords - 1] = parseInt(val, cursor,  cursor += firstGroupLen);
-
-        // Process remaining digit groups
-        while (cursor < len) {
-            int groupVal = parseInt(val, cursor, cursor += digitsPerInt[10]);
-            destructiveMulAdd(magnitude, intRadix[10], groupVal);
-        }
-        mag = trustedStripLeadingZeroInts(magnitude);
-    }
-
-    // Create an integer with the digits between the two indexes
-    // Assumes start < end. The result may be negative, but it
-    // is to be treated as an unsigned value.
-    private int parseInt(char[] source, int start, int end) {
-        int result = Character.digit(source[start++], 10);
-        if (result == -1)
-            throw new NumberFormatException(new String(source));
-
-        for (int index = start; index<end; index++) {
-            int nextVal = Character.digit(source[index], 10);
-            if (nextVal == -1)
-                throw new NumberFormatException(new String(source));
-            result = 10*result + nextVal;
-        }
-
-        return result;
-    }
-
-    // bitsPerDigit in the given radix times 1024
-    // Rounded up to avoid underallocation.
-    private static long bitsPerDigit[] = { 0, 0,
-        1024, 1624, 2048, 2378, 2648, 2875, 3072, 3247, 3402, 3543, 3672,
-        3790, 3899, 4001, 4096, 4186, 4271, 4350, 4426, 4498, 4567, 4633,
-        4696, 4756, 4814, 4870, 4923, 4975, 5025, 5074, 5120, 5166, 5210,
-                                           5253, 5295};
-
-    // Multiply x array times word y in place, and add word z
-    private static void destructiveMulAdd(int[] x, int y, int z) {
-        // Perform the multiplication word by word
-        long ylong = y & LONG_MASK;
-        long zlong = z & LONG_MASK;
-        int len = x.length;
-
-        long product = 0;
-        long carry = 0;
-        for (int i = len-1; i >= 0; i--) {
-            product = ylong * (x[i] & LONG_MASK) + carry;
-            x[i] = (int)product;
-            carry = product >>> 32;
-        }
-
-        // Perform the addition
-        long sum = (x[len-1] & LONG_MASK) + zlong;
-        x[len-1] = (int)sum;
-        carry = sum >>> 32;
-        for (int i = len-2; i >= 0; i--) {
-            sum = (x[i] & LONG_MASK) + carry;
-            x[i] = (int)sum;
-            carry = sum >>> 32;
-        }
-    }
-
-    /**
-     * Translates the decimal String representation of a BigInteger into a
-     * BigInteger.  The String representation consists of an optional minus
-     * sign followed by a sequence of one or more decimal digits.  The
-     * character-to-digit mapping is provided by {@code Character.digit}.
-     * The String may not contain any extraneous characters (whitespace, for
-     * example).
-     *
-     * @param val decimal String representation of BigInteger.
-     * @throws NumberFormatException {@code val} is not a valid representation
-     *         of a BigInteger.
-     * @see    Character#digit
-     */
-    public BigInteger(String val) {
-        this(val, 10);
-    }
-
-    /**
-     * Constructs a randomly generated BigInteger, uniformly distributed over
-     * the range 0 to (2<sup>{@code numBits}</sup> - 1), inclusive.
-     * The uniformity of the distribution assumes that a fair source of random
-     * bits is provided in {@code rnd}.  Note that this constructor always
-     * constructs a non-negative BigInteger.
-     *
-     * @param  numBits maximum bitLength of the new BigInteger.
-     * @param  rnd source of randomness to be used in computing the new
-     *         BigInteger.
-     * @throws IllegalArgumentException {@code numBits} is negative.
-     * @see #bitLength()
-     */
-    public BigInteger(int numBits, Random rnd) {
-        this(1, randomBits(numBits, rnd));
-    }
-
-    private static byte[] randomBits(int numBits, Random rnd) {
-        if (numBits < 0)
-            throw new IllegalArgumentException("numBits must be non-negative");
-        int numBytes = (int)(((long)numBits+7)/8); // avoid overflow
-        byte[] randomBits = new byte[numBytes];
-
-        // Generate random bytes and mask out any excess bits
-        if (numBytes > 0) {
-            rnd.nextBytes(randomBits);
-            int excessBits = 8*numBytes - numBits;
-            randomBits[0] &= (1 << (8-excessBits)) - 1;
-        }
-        return randomBits;
-    }
-
-    /**
-     * Constructs a randomly generated positive BigInteger that is probably
-     * prime, with the specified bitLength.
-     *
-     * <p>It is recommended that the {@link #probablePrime probablePrime}
-     * method be used in preference to this constructor unless there
-     * is a compelling need to specify a certainty.
-     *
-     * @param  bitLength bitLength of the returned BigInteger.
-     * @param  certainty a measure of the uncertainty that the caller is
-     *         willing to tolerate.  The probability that the new BigInteger
-     *         represents a prime number will exceed
-     *         (1 - 1/2<sup>{@code certainty}</sup>).  The execution time of
-     *         this constructor is proportional to the value of this parameter.
-     * @param  rnd source of random bits used to select candidates to be
-     *         tested for primality.
-     * @throws ArithmeticException {@code bitLength < 2}.
-     * @see    #bitLength()
-     */
-    public BigInteger(int bitLength, int certainty, Random rnd) {
-        BigInteger prime;
-
-        if (bitLength < 2)
-            throw new ArithmeticException("bitLength < 2");
-        // The cutoff of 95 was chosen empirically for best performance
-        prime = (bitLength < 95 ? smallPrime(bitLength, certainty, rnd)
-                                : largePrime(bitLength, certainty, rnd));
-        signum = 1;
-        mag = prime.mag;
-    }
-
-    // Minimum size in bits that the requested prime number has
-    // before we use the large prime number generating algorithms
-    private static final int SMALL_PRIME_THRESHOLD = 95;
-
-    // Certainty required to meet the spec of probablePrime
-    private static final int DEFAULT_PRIME_CERTAINTY = 100;
-
-    /**
-     * Returns a positive BigInteger that is probably prime, with the
-     * specified bitLength. The probability that a BigInteger returned
-     * by this method is composite does not exceed 2<sup>-100</sup>.
-     *
-     * @param  bitLength bitLength of the returned BigInteger.
-     * @param  rnd source of random bits used to select candidates to be
-     *         tested for primality.
-     * @return a BigInteger of {@code bitLength} bits that is probably prime
-     * @throws ArithmeticException {@code bitLength < 2}.
-     * @see    #bitLength()
-     * @since 1.4
-     */
-    public static BigInteger probablePrime(int bitLength, Random rnd) {
-        if (bitLength < 2)
-            throw new ArithmeticException("bitLength < 2");
-
-        // The cutoff of 95 was chosen empirically for best performance
-        return (bitLength < SMALL_PRIME_THRESHOLD ?
-                smallPrime(bitLength, DEFAULT_PRIME_CERTAINTY, rnd) :
-                largePrime(bitLength, DEFAULT_PRIME_CERTAINTY, rnd));
-    }
-
-    /**
-     * Find a random number of the specified bitLength that is probably prime.
-     * This method is used for smaller primes, its performance degrades on
-     * larger bitlengths.
-     *
-     * This method assumes bitLength > 1.
-     */
-    private static BigInteger smallPrime(int bitLength, int certainty, Random rnd) {
-        int magLen = (bitLength + 31) >>> 5;
-        int temp[] = new int[magLen];
-        int highBit = 1 << ((bitLength+31) & 0x1f);  // High bit of high int
-        int highMask = (highBit << 1) - 1;  // Bits to keep in high int
-
-        while(true) {
-            // Construct a candidate
-            for (int i=0; i<magLen; i++)
-                temp[i] = rnd.nextInt();
-            temp[0] = (temp[0] & highMask) | highBit;  // Ensure exact length
-            if (bitLength > 2)
-                temp[magLen-1] |= 1;  // Make odd if bitlen > 2
-
-            BigInteger p = new BigInteger(temp, 1);
-
-            // Do cheap "pre-test" if applicable
-            if (bitLength > 6) {
-                long r = p.remainder(SMALL_PRIME_PRODUCT).longValue();
-                if ((r%3==0)  || (r%5==0)  || (r%7==0)  || (r%11==0) ||
-                    (r%13==0) || (r%17==0) || (r%19==0) || (r%23==0) ||
-                    (r%29==0) || (r%31==0) || (r%37==0) || (r%41==0))
-                    continue; // Candidate is composite; try another
-            }
-
-            // All candidates of bitLength 2 and 3 are prime by this point
-            if (bitLength < 4)
-                return p;
-
-            // Do expensive test if we survive pre-test (or it's inapplicable)
-            if (p.primeToCertainty(certainty, rnd))
-                return p;
-        }
-    }
-
-    private static final BigInteger SMALL_PRIME_PRODUCT
-                       = valueOf(3L*5*7*11*13*17*19*23*29*31*37*41);
-
-    /**
-     * Find a random number of the specified bitLength that is probably prime.
-     * This method is more appropriate for larger bitlengths since it uses
-     * a sieve to eliminate most composites before using a more expensive
-     * test.
-     */
-    private static BigInteger largePrime(int bitLength, int certainty, Random rnd) {
-        BigInteger p;
-        p = new BigInteger(bitLength, rnd).setBit(bitLength-1);
-        p.mag[p.mag.length-1] &= 0xfffffffe;
-
-        // Use a sieve length likely to contain the next prime number
-        int searchLen = (bitLength / 20) * 64;
-        BitSieve searchSieve = new BitSieve(p, searchLen);
-        BigInteger candidate = searchSieve.retrieve(p, certainty, rnd);
-
-        while ((candidate == null) || (candidate.bitLength() != bitLength)) {
-            p = p.add(BigInteger.valueOf(2*searchLen));
-            if (p.bitLength() != bitLength)
-                p = new BigInteger(bitLength, rnd).setBit(bitLength-1);
-            p.mag[p.mag.length-1] &= 0xfffffffe;
-            searchSieve = new BitSieve(p, searchLen);
-            candidate = searchSieve.retrieve(p, certainty, rnd);
-        }
-        return candidate;
-    }
-
-   /**
-    * Returns the first integer greater than this {@code BigInteger} that
-    * is probably prime.  The probability that the number returned by this
-    * method is composite does not exceed 2<sup>-100</sup>. This method will
-    * never skip over a prime when searching: if it returns {@code p}, there
-    * is no prime {@code q} such that {@code this < q < p}.
-    *
-    * @return the first integer greater than this {@code BigInteger} that
-    *         is probably prime.
-    * @throws ArithmeticException {@code this < 0}.
-    * @since 1.5
-    */
-    public BigInteger nextProbablePrime() {
-        if (this.signum < 0)
-            throw new ArithmeticException("start < 0: " + this);
-
-        // Handle trivial cases
-        if ((this.signum == 0) || this.equals(ONE))
-            return TWO;
-
-        BigInteger result = this.add(ONE);
-
-        // Fastpath for small numbers
-        if (result.bitLength() < SMALL_PRIME_THRESHOLD) {
-
-            // Ensure an odd number
-            if (!result.testBit(0))
-                result = result.add(ONE);
-
-            while(true) {
-                // Do cheap "pre-test" if applicable
-                if (result.bitLength() > 6) {
-                    long r = result.remainder(SMALL_PRIME_PRODUCT).longValue();
-                    if ((r%3==0)  || (r%5==0)  || (r%7==0)  || (r%11==0) ||
-                        (r%13==0) || (r%17==0) || (r%19==0) || (r%23==0) ||
-                        (r%29==0) || (r%31==0) || (r%37==0) || (r%41==0)) {
-                        result = result.add(TWO);
-                        continue; // Candidate is composite; try another
-                    }
-                }
-
-                // All candidates of bitLength 2 and 3 are prime by this point
-                if (result.bitLength() < 4)
-                    return result;
-
-                // The expensive test
-                if (result.primeToCertainty(DEFAULT_PRIME_CERTAINTY, null))
-                    return result;
-
-                result = result.add(TWO);
-            }
-        }
-
-        // Start at previous even number
-        if (result.testBit(0))
-            result = result.subtract(ONE);
-
-        // Looking for the next large prime
-        int searchLen = (result.bitLength() / 20) * 64;
-
-        while(true) {
-           BitSieve searchSieve = new BitSieve(result, searchLen);
-           BigInteger candidate = searchSieve.retrieve(result,
-                                                 DEFAULT_PRIME_CERTAINTY, null);
-           if (candidate != null)
-               return candidate;
-           result = result.add(BigInteger.valueOf(2 * searchLen));
-        }
-    }
-
-    /**
-     * Returns {@code true} if this BigInteger is probably prime,
-     * {@code false} if it's definitely composite.
-     *
-     * This method assumes bitLength > 2.
-     *
-     * @param  certainty a measure of the uncertainty that the caller is
-     *         willing to tolerate: if the call returns {@code true}
-     *         the probability that this BigInteger is prime exceeds
-     *         {@code (1 - 1/2<sup>certainty</sup>)}.  The execution time of
-     *         this method is proportional to the value of this parameter.
-     * @return {@code true} if this BigInteger is probably prime,
-     *         {@code false} if it's definitely composite.
-     */
-    boolean primeToCertainty(int certainty, Random random) {
-        int rounds = 0;
-        int n = (Math.min(certainty, Integer.MAX_VALUE-1)+1)/2;
-
-        // The relationship between the certainty and the number of rounds
-        // we perform is given in the draft standard ANSI X9.80, "PRIME
-        // NUMBER GENERATION, PRIMALITY TESTING, AND PRIMALITY CERTIFICATES".
-        int sizeInBits = this.bitLength();
-        if (sizeInBits < 100) {
-            rounds = 50;
-            rounds = n < rounds ? n : rounds;
-            return passesMillerRabin(rounds, random);
-        }
-
-        if (sizeInBits < 256) {
-            rounds = 27;
-        } else if (sizeInBits < 512) {
-            rounds = 15;
-        } else if (sizeInBits < 768) {
-            rounds = 8;
-        } else if (sizeInBits < 1024) {
-            rounds = 4;
-        } else {
-            rounds = 2;
-        }
-        rounds = n < rounds ? n : rounds;
-
-        return passesMillerRabin(rounds, random) && passesLucasLehmer();
-    }
-
-    /**
-     * Returns true iff this BigInteger is a Lucas-Lehmer probable prime.
-     *
-     * The following assumptions are made:
-     * This BigInteger is a positive, odd number.
-     */
-    private boolean passesLucasLehmer() {
-        BigInteger thisPlusOne = this.add(ONE);
-
-        // Step 1
-        int d = 5;
-        while (jacobiSymbol(d, this) != -1) {
-            // 5, -7, 9, -11, ...
-            d = (d<0) ? Math.abs(d)+2 : -(d+2);
-        }
-
-        // Step 2
-        BigInteger u = lucasLehmerSequence(d, thisPlusOne, this);
-
-        // Step 3
-        return u.mod(this).equals(ZERO);
-    }
-
-    /**
-     * Computes Jacobi(p,n).
-     * Assumes n positive, odd, n>=3.
-     */
-    private static int jacobiSymbol(int p, BigInteger n) {
-        if (p == 0)
-            return 0;
-
-        // Algorithm and comments adapted from Colin Plumb's C library.
-        int j = 1;
-        int u = n.mag[n.mag.length-1];
-
-        // Make p positive
-        if (p < 0) {
-            p = -p;
-            int n8 = u & 7;
-            if ((n8 == 3) || (n8 == 7))
-                j = -j; // 3 (011) or 7 (111) mod 8
-        }
-
-        // Get rid of factors of 2 in p
-        while ((p & 3) == 0)
-            p >>= 2;
-        if ((p & 1) == 0) {
-            p >>= 1;
-            if (((u ^ (u>>1)) & 2) != 0)
-                j = -j; // 3 (011) or 5 (101) mod 8
-        }
-        if (p == 1)
-            return j;
-        // Then, apply quadratic reciprocity
-        if ((p & u & 2) != 0)   // p = u = 3 (mod 4)?
-            j = -j;
-        // And reduce u mod p
-        u = n.mod(BigInteger.valueOf(p)).intValue();
-
-        // Now compute Jacobi(u,p), u < p
-        while (u != 0) {
-            while ((u & 3) == 0)
-                u >>= 2;
-            if ((u & 1) == 0) {
-                u >>= 1;
-                if (((p ^ (p>>1)) & 2) != 0)
-                    j = -j;     // 3 (011) or 5 (101) mod 8
-            }
-            if (u == 1)
-                return j;
-            // Now both u and p are odd, so use quadratic reciprocity
-            assert (u < p);
-            int t = u; u = p; p = t;
-            if ((u & p & 2) != 0) // u = p = 3 (mod 4)?
-                j = -j;
-            // Now u >= p, so it can be reduced
-            u %= p;
-        }
-        return 0;
-    }
-
-    private static BigInteger lucasLehmerSequence(int z, BigInteger k, BigInteger n) {
-        BigInteger d = BigInteger.valueOf(z);
-        BigInteger u = ONE; BigInteger u2;
-        BigInteger v = ONE; BigInteger v2;
-
-        for (int i=k.bitLength()-2; i>=0; i--) {
-            u2 = u.multiply(v).mod(n);
-
-            v2 = v.square().add(d.multiply(u.square())).mod(n);
-            if (v2.testBit(0))
-                v2 = v2.subtract(n);
-
-            v2 = v2.shiftRight(1);
-
-            u = u2; v = v2;
-            if (k.testBit(i)) {
-                u2 = u.add(v).mod(n);
-                if (u2.testBit(0))
-                    u2 = u2.subtract(n);
-
-                u2 = u2.shiftRight(1);
-                v2 = v.add(d.multiply(u)).mod(n);
-                if (v2.testBit(0))
-                    v2 = v2.subtract(n);
-                v2 = v2.shiftRight(1);
-
-                u = u2; v = v2;
-            }
-        }
-        return u;
-    }
-
-    private static volatile Random staticRandom;
-
-    private static Random getSecureRandom() {
-        if (staticRandom == null) {
-            staticRandom = new java.security.SecureRandom();
-        }
-        return staticRandom;
-    }
-
-    /**
-     * Returns true iff this BigInteger passes the specified number of
-     * Miller-Rabin tests. This test is taken from the DSA spec (NIST FIPS
-     * 186-2).
-     *
-     * The following assumptions are made:
-     * This BigInteger is a positive, odd number greater than 2.
-     * iterations<=50.
-     */
-    private boolean passesMillerRabin(int iterations, Random rnd) {
-        // Find a and m such that m is odd and this == 1 + 2**a * m
-        BigInteger thisMinusOne = this.subtract(ONE);
-        BigInteger m = thisMinusOne;
-        int a = m.getLowestSetBit();
-        m = m.shiftRight(a);
-
-        // Do the tests
-        if (rnd == null) {
-            rnd = getSecureRandom();
-        }
-        for (int i=0; i<iterations; i++) {
-            // Generate a uniform random on (1, this)
-            BigInteger b;
-            do {
-                b = new BigInteger(this.bitLength(), rnd);
-            } while (b.compareTo(ONE) <= 0 || b.compareTo(this) >= 0);
-
-            int j = 0;
-            BigInteger z = b.modPow(m, this);
-            while(!((j==0 && z.equals(ONE)) || z.equals(thisMinusOne))) {
-                if (j>0 && z.equals(ONE) || ++j==a)
-                    return false;
-                z = z.modPow(TWO, this);
-            }
-        }
-        return true;
-    }
-
-    /**
-     * This internal constructor differs from its public cousin
-     * with the arguments reversed in two ways: it assumes that its
-     * arguments are correct, and it doesn't copy the magnitude array.
-     */
-    BigInteger(int[] magnitude, int signum) {
-        this.signum = (magnitude.length==0 ? 0 : signum);
-        this.mag = magnitude;
-    }
-
-    /**
-     * This private constructor is for internal use and assumes that its
-     * arguments are correct.
-     */
-    private BigInteger(byte[] magnitude, int signum) {
-        this.signum = (magnitude.length==0 ? 0 : signum);
-        this.mag = stripLeadingZeroBytes(magnitude);
-    }
-
-    //Static Factory Methods
-
-    /**
-     * Returns a BigInteger whose value is equal to that of the
-     * specified {@code long}.  This "static factory method" is
-     * provided in preference to a ({@code long}) constructor
-     * because it allows for reuse of frequently used BigIntegers.
-     *
-     * @param  val value of the BigInteger to return.
-     * @return a BigInteger with the specified value.
-     */
-    public static BigInteger valueOf(long val) {
-        // If -MAX_CONSTANT < val < MAX_CONSTANT, return stashed constant
-        if (val == 0)
-            return ZERO;
-        if (val > 0 && val <= MAX_CONSTANT)
-            return posConst[(int) val];
-        else if (val < 0 && val >= -MAX_CONSTANT)
-            return negConst[(int) -val];
-
-        return new BigInteger(val);
-    }
-
-    /**
-     * Constructs a BigInteger with the specified value, which may not be zero.
-     */
-    private BigInteger(long val) {
-        if (val < 0) {
-            val = -val;
-            signum = -1;
-        } else {
-            signum = 1;
-        }
-
-        int highWord = (int)(val >>> 32);
-        if (highWord==0) {
-            mag = new int[1];
-            mag[0] = (int)val;
-        } else {
-            mag = new int[2];
-            mag[0] = highWord;
-            mag[1] = (int)val;
-        }
-    }
-
-    /**
-     * Returns a BigInteger with the given two's complement representation.
-     * Assumes that the input array will not be modified (the returned
-     * BigInteger will reference the input array if feasible).
-     */
-    private static BigInteger valueOf(int val[]) {
-        return (val[0]>0 ? new BigInteger(val, 1) : new BigInteger(val));
-    }
-
-    // Constants
-
-    /**
-     * Initialize static constant array when class is loaded.
-     */
-    private final static int MAX_CONSTANT = 16;
-    private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];
-    private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1];
-    static {
-        for (int i = 1; i <= MAX_CONSTANT; i++) {
-            int[] magnitude = new int[1];
-            magnitude[0] = i;
-            posConst[i] = new BigInteger(magnitude,  1);
-            negConst[i] = new BigInteger(magnitude, -1);
-        }
-    }
-
-    /**
-     * The BigInteger constant zero.
-     *
-     * @since   1.2
-     */
-    public static final BigInteger ZERO = new BigInteger(new int[0], 0);
-
-    /**
-     * The BigInteger constant one.
-     *
-     * @since   1.2
-     */
-    public static final BigInteger ONE = valueOf(1);
-
-    /**
-     * The BigInteger constant two.  (Not exported.)
-     */
-    private static final BigInteger TWO = valueOf(2);
-
-    /**
-     * The BigInteger constant ten.
-     *
-     * @since   1.5
-     */
-    public static final BigInteger TEN = valueOf(10);
-
-    // Arithmetic Operations
-
-    /**
-     * Returns a BigInteger whose value is {@code (this + val)}.
-     *
-     * @param  val value to be added to this BigInteger.
-     * @return {@code this + val}
-     */
-    public BigInteger add(BigInteger val) {
-        if (val.signum == 0)
-            return this;
-        if (signum == 0)
-            return val;
-        if (val.signum == signum)
-            return new BigInteger(add(mag, val.mag), signum);
-
-        int cmp = compareMagnitude(val);
-        if (cmp == 0)
-            return ZERO;
-        int[] resultMag = (cmp > 0 ? subtract(mag, val.mag)
-                           : subtract(val.mag, mag));
-        resultMag = trustedStripLeadingZeroInts(resultMag);
-
-        return new BigInteger(resultMag, cmp == signum ? 1 : -1);
-    }
-
-    /**
-     * Adds the contents of the int arrays x and y. This method allocates
-     * a new int array to hold the answer and returns a reference to that
-     * array.
-     */
-    private static int[] add(int[] x, int[] y) {
-        // If x is shorter, swap the two arrays
-        if (x.length < y.length) {
-            int[] tmp = x;
-            x = y;
-            y = tmp;
-        }
-
-        int xIndex = x.length;
-        int yIndex = y.length;
-        int result[] = new int[xIndex];
-        long sum = 0;
-
-        // Add common parts of both numbers
-        while(yIndex > 0) {
-            sum = (x[--xIndex] & LONG_MASK) +
-                  (y[--yIndex] & LONG_MASK) + (sum >>> 32);
-            result[xIndex] = (int)sum;
-        }
-
-        // Copy remainder of longer number while carry propagation is required
-        boolean carry = (sum >>> 32 != 0);
-        while (xIndex > 0 && carry)
-            carry = ((result[--xIndex] = x[xIndex] + 1) == 0);
-
-        // Copy remainder of longer number
-        while (xIndex > 0)
-            result[--xIndex] = x[xIndex];
-
-        // Grow result if necessary
-        if (carry) {
-            int bigger[] = new int[result.length + 1];
-            System.arraycopy(result, 0, bigger, 1, result.length);
-            bigger[0] = 0x01;
-            return bigger;
-        }
-        return result;
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this - val)}.
-     *
-     * @param  val value to be subtracted from this BigInteger.
-     * @return {@code this - val}
-     */
-    public BigInteger subtract(BigInteger val) {
-        if (val.signum == 0)
-            return this;
-        if (signum == 0)
-            return val.negate();
-        if (val.signum != signum)
-            return new BigInteger(add(mag, val.mag), signum);
-
-        int cmp = compareMagnitude(val);
-        if (cmp == 0)
-            return ZERO;
-        int[] resultMag = (cmp > 0 ? subtract(mag, val.mag)
-                           : subtract(val.mag, mag));
-        resultMag = trustedStripLeadingZeroInts(resultMag);
-        return new BigInteger(resultMag, cmp == signum ? 1 : -1);
-    }
-
-    /**
-     * Subtracts the contents of the second int arrays (little) from the
-     * first (big).  The first int array (big) must represent a larger number
-     * than the second.  This method allocates the space necessary to hold the
-     * answer.
-     */
-    private static int[] subtract(int[] big, int[] little) {
-        int bigIndex = big.length;
-        int result[] = new int[bigIndex];
-        int littleIndex = little.length;
-        long difference = 0;
-
-        // Subtract common parts of both numbers
-        while(littleIndex > 0) {
-            difference = (big[--bigIndex] & LONG_MASK) -
-                         (little[--littleIndex] & LONG_MASK) +
-                         (difference >> 32);
-            result[bigIndex] = (int)difference;
-        }
-
-        // Subtract remainder of longer number while borrow propagates
-        boolean borrow = (difference >> 32 != 0);
-        while (bigIndex > 0 && borrow)
-            borrow = ((result[--bigIndex] = big[bigIndex] - 1) == -1);
-
-        // Copy remainder of longer number
-        while (bigIndex > 0)
-            result[--bigIndex] = big[bigIndex];
-
-        return result;
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this * val)}.
-     *
-     * @param  val value to be multiplied by this BigInteger.
-     * @return {@code this * val}
-     */
-    public BigInteger multiply(BigInteger val) {
-        if (val.signum == 0 || signum == 0)
-            return ZERO;
-
-        int[] result = multiplyToLen(mag, mag.length,
-                                     val.mag, val.mag.length, null);
-        result = trustedStripLeadingZeroInts(result);
-        return new BigInteger(result, signum == val.signum ? 1 : -1);
-    }
-
-    /**
-     * Package private methods used by BigDecimal code to multiply a BigInteger
-     * with a long. Assumes v is not equal to INFLATED.
-     */
-    BigInteger multiply(long v) {
-        if (v == 0 || signum == 0)
-          return ZERO;
-        if (v == BigDecimal.INFLATED)
-            return multiply(BigInteger.valueOf(v));
-        int rsign = (v > 0 ? signum : -signum);
-        if (v < 0)
-            v = -v;
-        long dh = v >>> 32;      // higher order bits
-        long dl = v & LONG_MASK; // lower order bits
-
-        int xlen = mag.length;
-        int[] value = mag;
-        int[] rmag = (dh == 0L) ? (new int[xlen + 1]) : (new int[xlen + 2]);
-        long carry = 0;
-        int rstart = rmag.length - 1;
-        for (int i = xlen - 1; i >= 0; i--) {
-            long product = (value[i] & LONG_MASK) * dl + carry;
-            rmag[rstart--] = (int)product;
-            carry = product >>> 32;
-        }
-        rmag[rstart] = (int)carry;
-        if (dh != 0L) {
-            carry = 0;
-            rstart = rmag.length - 2;
-            for (int i = xlen - 1; i >= 0; i--) {
-                long product = (value[i] & LONG_MASK) * dh +
-                    (rmag[rstart] & LONG_MASK) + carry;
-                rmag[rstart--] = (int)product;
-                carry = product >>> 32;
-            }
-            rmag[0] = (int)carry;
-        }
-        if (carry == 0L)
-            rmag = java.util.Arrays.copyOfRange(rmag, 1, rmag.length);
-        return new BigInteger(rmag, rsign);
-    }
-
-    /**
-     * Multiplies int arrays x and y to the specified lengths and places
-     * the result into z. There will be no leading zeros in the resultant array.
-     */
-    private int[] multiplyToLen(int[] x, int xlen, int[] y, int ylen, int[] z) {
-        int xstart = xlen - 1;
-        int ystart = ylen - 1;
-
-        if (z == null || z.length < (xlen+ ylen))
-            z = new int[xlen+ylen];
-
-        long carry = 0;
-        for (int j=ystart, k=ystart+1+xstart; j>=0; j--, k--) {
-            long product = (y[j] & LONG_MASK) *
-                           (x[xstart] & LONG_MASK) + carry;
-            z[k] = (int)product;
-            carry = product >>> 32;
-        }
-        z[xstart] = (int)carry;
-
-        for (int i = xstart-1; i >= 0; i--) {
-            carry = 0;
-            for (int j=ystart, k=ystart+1+i; j>=0; j--, k--) {
-                long product = (y[j] & LONG_MASK) *
-                               (x[i] & LONG_MASK) +
-                               (z[k] & LONG_MASK) + carry;
-                z[k] = (int)product;
-                carry = product >>> 32;
-            }
-            z[i] = (int)carry;
-        }
-        return z;
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this<sup>2</sup>)}.
-     *
-     * @return {@code this<sup>2</sup>}
-     */
-    private BigInteger square() {
-        if (signum == 0)
-            return ZERO;
-        int[] z = squareToLen(mag, mag.length, null);
-        return new BigInteger(trustedStripLeadingZeroInts(z), 1);
-    }
-
-    /**
-     * Squares the contents of the int array x. The result is placed into the
-     * int array z.  The contents of x are not changed.
-     */
-    private static final int[] squareToLen(int[] x, int len, int[] z) {
-        /*
-         * The algorithm used here is adapted from Colin Plumb's C library.
-         * Technique: Consider the partial products in the multiplication
-         * of "abcde" by itself:
-         *
-         *               a  b  c  d  e
-         *            *  a  b  c  d  e
-         *          ==================
-         *              ae be ce de ee
-         *           ad bd cd dd de
-         *        ac bc cc cd ce
-         *     ab bb bc bd be
-         *  aa ab ac ad ae
-         *
-         * Note that everything above the main diagonal:
-         *              ae be ce de = (abcd) * e
-         *           ad bd cd       = (abc) * d
-         *        ac bc             = (ab) * c
-         *     ab                   = (a) * b
-         *
-         * is a copy of everything below the main diagonal:
-         *                       de
-         *                 cd ce
-         *           bc bd be
-         *     ab ac ad ae
-         *
-         * Thus, the sum is 2 * (off the diagonal) + diagonal.
-         *
-         * This is accumulated beginning with the diagonal (which
-         * consist of the squares of the digits of the input), which is then
-         * divided by two, the off-diagonal added, and multiplied by two
-         * again.  The low bit is simply a copy of the low bit of the
-         * input, so it doesn't need special care.
-         */
-        int zlen = len << 1;
-        if (z == null || z.length < zlen)
-            z = new int[zlen];
-
-        // Store the squares, right shifted one bit (i.e., divided by 2)
-        int lastProductLowWord = 0;
-        for (int j=0, i=0; j<len; j++) {
-            long piece = (x[j] & LONG_MASK);
-            long product = piece * piece;
-            z[i++] = (lastProductLowWord << 31) | (int)(product >>> 33);
-            z[i++] = (int)(product >>> 1);
-            lastProductLowWord = (int)product;
-        }
-
-        // Add in off-diagonal sums
-        for (int i=len, offset=1; i>0; i--, offset+=2) {
-            int t = x[i-1];
-            t = mulAdd(z, x, offset, i-1, t);
-            addOne(z, offset-1, i, t);
-        }
-
-        // Shift back up and set low bit
-        primitiveLeftShift(z, zlen, 1);
-        z[zlen-1] |= x[len-1] & 1;
-
-        return z;
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this / val)}.
-     *
-     * @param  val value by which this BigInteger is to be divided.
-     * @return {@code this / val}
-     * @throws ArithmeticException if {@code val} is zero.
-     */
-    public BigInteger divide(BigInteger val) {
-        MutableBigInteger q = new MutableBigInteger(),
-                          a = new MutableBigInteger(this.mag),
-                          b = new MutableBigInteger(val.mag);
-
-        a.divide(b, q);
-        return q.toBigInteger(this.signum == val.signum ? 1 : -1);
-    }
-
-    /**
-     * Returns an array of two BigIntegers containing {@code (this / val)}
-     * followed by {@code (this % val)}.
-     *
-     * @param  val value by which this BigInteger is to be divided, and the
-     *         remainder computed.
-     * @return an array of two BigIntegers: the quotient {@code (this / val)}
-     *         is the initial element, and the remainder {@code (this % val)}
-     *         is the final element.
-     * @throws ArithmeticException if {@code val} is zero.
-     */
-    public BigInteger[] divideAndRemainder(BigInteger val) {
-        BigInteger[] result = new BigInteger[2];
-        MutableBigInteger q = new MutableBigInteger(),
-                          a = new MutableBigInteger(this.mag),
-                          b = new MutableBigInteger(val.mag);
-        MutableBigInteger r = a.divide(b, q);
-        result[0] = q.toBigInteger(this.signum == val.signum ? 1 : -1);
-        result[1] = r.toBigInteger(this.signum);
-        return result;
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this % val)}.
-     *
-     * @param  val value by which this BigInteger is to be divided, and the
-     *         remainder computed.
-     * @return {@code this % val}
-     * @throws ArithmeticException if {@code val} is zero.
-     */
-    public BigInteger remainder(BigInteger val) {
-        MutableBigInteger q = new MutableBigInteger(),
-                          a = new MutableBigInteger(this.mag),
-                          b = new MutableBigInteger(val.mag);
-
-        return a.divide(b, q).toBigInteger(this.signum);
-    }
-
-    /**
-     * Returns a BigInteger whose value is <tt>(this<sup>exponent</sup>)</tt>.
-     * Note that {@code exponent} is an integer rather than a BigInteger.
-     *
-     * @param  exponent exponent to which this BigInteger is to be raised.
-     * @return <tt>this<sup>exponent</sup></tt>
-     * @throws ArithmeticException {@code exponent} is negative.  (This would
-     *         cause the operation to yield a non-integer value.)
-     */
-    public BigInteger pow(int exponent) {
-        if (exponent < 0)
-            throw new ArithmeticException("Negative exponent");
-        if (signum==0)
-            return (exponent==0 ? ONE : this);
-
-        // Perform exponentiation using repeated squaring trick
-        int newSign = (signum<0 && (exponent&1)==1 ? -1 : 1);
-        int[] baseToPow2 = this.mag;
-        int[] result = {1};
-
-        while (exponent != 0) {
-            if ((exponent & 1)==1) {
-                result = multiplyToLen(result, result.length,
-                                       baseToPow2, baseToPow2.length, null);
-                result = trustedStripLeadingZeroInts(result);
-            }
-            if ((exponent >>>= 1) != 0) {
-                baseToPow2 = squareToLen(baseToPow2, baseToPow2.length, null);
-                baseToPow2 = trustedStripLeadingZeroInts(baseToPow2);
-            }
-        }
-        return new BigInteger(result, newSign);
-    }
-
-    /**
-     * Returns a BigInteger whose value is the greatest common divisor of
-     * {@code abs(this)} and {@code abs(val)}.  Returns 0 if
-     * {@code this==0 && val==0}.
-     *
-     * @param  val value with which the GCD is to be computed.
-     * @return {@code GCD(abs(this), abs(val))}
-     */
-    public BigInteger gcd(BigInteger val) {
-        if (val.signum == 0)
-            return this.abs();
-        else if (this.signum == 0)
-            return val.abs();
-
-        MutableBigInteger a = new MutableBigInteger(this);
-        MutableBigInteger b = new MutableBigInteger(val);
-
-        MutableBigInteger result = a.hybridGCD(b);
-
-        return result.toBigInteger(1);
-    }
-
-    /**
-     * Package private method to return bit length for an integer.
-     */
-    static int bitLengthForInt(int n) {
-        return 32 - Integer.numberOfLeadingZeros(n);
-    }
-
-    /**
-     * Left shift int array a up to len by n bits. Returns the array that
-     * results from the shift since space may have to be reallocated.
-     */
-    private static int[] leftShift(int[] a, int len, int n) {
-        int nInts = n >>> 5;
-        int nBits = n&0x1F;
-        int bitsInHighWord = bitLengthForInt(a[0]);
-
-        // If shift can be done without recopy, do so
-        if (n <= (32-bitsInHighWord)) {
-            primitiveLeftShift(a, len, nBits);
-            return a;
-        } else { // Array must be resized
-            if (nBits <= (32-bitsInHighWord)) {
-                int result[] = new int[nInts+len];
-                for (int i=0; i<len; i++)
-                    result[i] = a[i];
-                primitiveLeftShift(result, result.length, nBits);
-                return result;
-            } else {
-                int result[] = new int[nInts+len+1];
-                for (int i=0; i<len; i++)
-                    result[i] = a[i];
-                primitiveRightShift(result, result.length, 32 - nBits);
-                return result;
-            }
-        }
-    }
-
-    // shifts a up to len right n bits assumes no leading zeros, 0<n<32
-    static void primitiveRightShift(int[] a, int len, int n) {
-        int n2 = 32 - n;
-        for (int i=len-1, c=a[i]; i>0; i--) {
-            int b = c;
-            c = a[i-1];
-            a[i] = (c << n2) | (b >>> n);
-        }
-        a[0] >>>= n;
-    }
-
-    // shifts a up to len left n bits assumes no leading zeros, 0<=n<32
-    static void primitiveLeftShift(int[] a, int len, int n) {
-        if (len == 0 || n == 0)
-            return;
-
-        int n2 = 32 - n;
-        for (int i=0, c=a[i], m=i+len-1; i<m; i++) {
-            int b = c;
-            c = a[i+1];
-            a[i] = (b << n) | (c >>> n2);
-        }
-        a[len-1] <<= n;
-    }
-
-    /**
-     * Calculate bitlength of contents of the first len elements an int array,
-     * assuming there are no leading zero ints.
-     */
-    private static int bitLength(int[] val, int len) {
-        if (len == 0)
-            return 0;
-        return ((len - 1) << 5) + bitLengthForInt(val[0]);
-    }
-
-    /**
-     * Returns a BigInteger whose value is the absolute value of this
-     * BigInteger.
-     *
-     * @return {@code abs(this)}
-     */
-    public BigInteger abs() {
-        return (signum >= 0 ? this : this.negate());
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (-this)}.
-     *
-     * @return {@code -this}
-     */
-    public BigInteger negate() {
-        return new BigInteger(this.mag, -this.signum);
-    }
-
-    /**
-     * Returns the signum function of this BigInteger.
-     *
-     * @return -1, 0 or 1 as the value of this BigInteger is negative, zero or
-     *         positive.
-     */
-    public int signum() {
-        return this.signum;
-    }
-
-    // Modular Arithmetic Operations
-
-    /**
-     * Returns a BigInteger whose value is {@code (this mod m}).  This method
-     * differs from {@code remainder} in that it always returns a
-     * <i>non-negative</i> BigInteger.
-     *
-     * @param  m the modulus.
-     * @return {@code this mod m}
-     * @throws ArithmeticException {@code m} &le; 0
-     * @see    #remainder
-     */
-    public BigInteger mod(BigInteger m) {
-        if (m.signum <= 0)
-            throw new ArithmeticException("BigInteger: modulus not positive");
-
-        BigInteger result = this.remainder(m);
-        return (result.signum >= 0 ? result : result.add(m));
-    }
-
-    /**
-     * Returns a BigInteger whose value is
-     * <tt>(this<sup>exponent</sup> mod m)</tt>.  (Unlike {@code pow}, this
-     * method permits negative exponents.)
-     *
-     * @param  exponent the exponent.
-     * @param  m the modulus.
-     * @return <tt>this<sup>exponent</sup> mod m</tt>
-     * @throws ArithmeticException {@code m} &le; 0 or the exponent is
-     *         negative and this BigInteger is not <i>relatively
-     *         prime</i> to {@code m}.
-     * @see    #modInverse
-     */
-    public BigInteger modPow(BigInteger exponent, BigInteger m) {
-        if (m.signum <= 0)
-            throw new ArithmeticException("BigInteger: modulus not positive");
-
-        // Trivial cases
-        if (exponent.signum == 0)
-            return (m.equals(ONE) ? ZERO : ONE);
-
-        if (this.equals(ONE))
-            return (m.equals(ONE) ? ZERO : ONE);
-
-        if (this.equals(ZERO) && exponent.signum >= 0)
-            return ZERO;
-
-        if (this.equals(negConst[1]) && (!exponent.testBit(0)))
-            return (m.equals(ONE) ? ZERO : ONE);
-
-        boolean invertResult;
-        if ((invertResult = (exponent.signum < 0)))
-            exponent = exponent.negate();
-
-        BigInteger base = (this.signum < 0 || this.compareTo(m) >= 0
-                           ? this.mod(m) : this);
-        BigInteger result;
-        if (m.testBit(0)) { // odd modulus
-            result = base.oddModPow(exponent, m);
-        } else {
-            /*
-             * Even modulus.  Tear it into an "odd part" (m1) and power of two
-             * (m2), exponentiate mod m1, manually exponentiate mod m2, and
-             * use Chinese Remainder Theorem to combine results.
-             */
-
-            // Tear m apart into odd part (m1) and power of 2 (m2)
-            int p = m.getLowestSetBit();   // Max pow of 2 that divides m
-
-            BigInteger m1 = m.shiftRight(p);  // m/2**p
-            BigInteger m2 = ONE.shiftLeft(p); // 2**p
-
-            // Calculate new base from m1
-            BigInteger base2 = (this.signum < 0 || this.compareTo(m1) >= 0
-                                ? this.mod(m1) : this);
-
-            // Caculate (base ** exponent) mod m1.
-            BigInteger a1 = (m1.equals(ONE) ? ZERO :
-                             base2.oddModPow(exponent, m1));
-
-            // Calculate (this ** exponent) mod m2
-            BigInteger a2 = base.modPow2(exponent, p);
-
-            // Combine results using Chinese Remainder Theorem
-            BigInteger y1 = m2.modInverse(m1);
-            BigInteger y2 = m1.modInverse(m2);
-
-            result = a1.multiply(m2).multiply(y1).add
-                     (a2.multiply(m1).multiply(y2)).mod(m);
-        }
-
-        return (invertResult ? result.modInverse(m) : result);
-    }
-
-    static int[] bnExpModThreshTable = {7, 25, 81, 241, 673, 1793,
-                                                Integer.MAX_VALUE}; // Sentinel
-
-    /**
-     * Returns a BigInteger whose value is x to the power of y mod z.
-     * Assumes: z is odd && x < z.
-     */
-    private BigInteger oddModPow(BigInteger y, BigInteger z) {
-    /*
-     * The algorithm is adapted from Colin Plumb's C library.
-     *
-     * The window algorithm:
-     * The idea is to keep a running product of b1 = n^(high-order bits of exp)
-     * and then keep appending exponent bits to it.  The following patterns
-     * apply to a 3-bit window (k = 3):
-     * To append   0: square
-     * To append   1: square, multiply by n^1
-     * To append  10: square, multiply by n^1, square
-     * To append  11: square, square, multiply by n^3
-     * To append 100: square, multiply by n^1, square, square
-     * To append 101: square, square, square, multiply by n^5
-     * To append 110: square, square, multiply by n^3, square
-     * To append 111: square, square, square, multiply by n^7
-     *
-     * Since each pattern involves only one multiply, the longer the pattern
-     * the better, except that a 0 (no multiplies) can be appended directly.
-     * We precompute a table of odd powers of n, up to 2^k, and can then
-     * multiply k bits of exponent at a time.  Actually, assuming random
-     * exponents, there is on average one zero bit between needs to
-     * multiply (1/2 of the time there's none, 1/4 of the time there's 1,
-     * 1/8 of the time, there's 2, 1/32 of the time, there's 3, etc.), so
-     * you have to do one multiply per k+1 bits of exponent.
-     *
-     * The loop walks down the exponent, squaring the result buffer as
-     * it goes.  There is a wbits+1 bit lookahead buffer, buf, that is
-     * filled with the upcoming exponent bits.  (What is read after the
-     * end of the exponent is unimportant, but it is filled with zero here.)
-     * When the most-significant bit of this buffer becomes set, i.e.
-     * (buf & tblmask) != 0, we have to decide what pattern to multiply
-     * by, and when to do it.  We decide, remember to do it in future
-     * after a suitable number of squarings have passed (e.g. a pattern
-     * of "100" in the buffer requires that we multiply by n^1 immediately;
-     * a pattern of "110" calls for multiplying by n^3 after one more
-     * squaring), clear the buffer, and continue.
-     *
-     * When we start, there is one more optimization: the result buffer
-     * is implcitly one, so squaring it or multiplying by it can be
-     * optimized away.  Further, if we start with a pattern like "100"
-     * in the lookahead window, rather than placing n into the buffer
-     * and then starting to square it, we have already computed n^2
-     * to compute the odd-powers table, so we can place that into
-     * the buffer and save a squaring.
-     *
-     * This means that if you have a k-bit window, to compute n^z,
-     * where z is the high k bits of the exponent, 1/2 of the time
-     * it requires no squarings.  1/4 of the time, it requires 1
-     * squaring, ... 1/2^(k-1) of the time, it reqires k-2 squarings.
-     * And the remaining 1/2^(k-1) of the time, the top k bits are a
-     * 1 followed by k-1 0 bits, so it again only requires k-2
-     * squarings, not k-1.  The average of these is 1.  Add that
-     * to the one squaring we have to do to compute the table,
-     * and you'll see that a k-bit window saves k-2 squarings
-     * as well as reducing the multiplies.  (It actually doesn't
-     * hurt in the case k = 1, either.)
-     */
-        // Special case for exponent of one
-        if (y.equals(ONE))
-            return this;
-
-        // Special case for base of zero
-        if (signum==0)
-            return ZERO;
-
-        int[] base = mag.clone();
-        int[] exp = y.mag;
-        int[] mod = z.mag;
-        int modLen = mod.length;
-
-        // Select an appropriate window size
-        int wbits = 0;
-        int ebits = bitLength(exp, exp.length);
-        // if exponent is 65537 (0x10001), use minimum window size
-        if ((ebits != 17) || (exp[0] != 65537)) {
-            while (ebits > bnExpModThreshTable[wbits]) {
-                wbits++;
-            }
-        }
-
-        // Calculate appropriate table size
-        int tblmask = 1 << wbits;
-
-        // Allocate table for precomputed odd powers of base in Montgomery form
-        int[][] table = new int[tblmask][];
-        for (int i=0; i<tblmask; i++)
-            table[i] = new int[modLen];
-
-        // Compute the modular inverse
-        int inv = -MutableBigInteger.inverseMod32(mod[modLen-1]);
-
-        // Convert base to Montgomery form
-        int[] a = leftShift(base, base.length, modLen << 5);
-
-        MutableBigInteger q = new MutableBigInteger(),
-                          a2 = new MutableBigInteger(a),
-                          b2 = new MutableBigInteger(mod);
-
-        MutableBigInteger r= a2.divide(b2, q);
-        table[0] = r.toIntArray();
-
-        // Pad table[0] with leading zeros so its length is at least modLen
-        if (table[0].length < modLen) {
-           int offset = modLen - table[0].length;
-           int[] t2 = new int[modLen];
-           for (int i=0; i<table[0].length; i++)
-               t2[i+offset] = table[0][i];
-           table[0] = t2;
-        }
-
-        // Set b to the square of the base
-        int[] b = squareToLen(table[0], modLen, null);
-        b = montReduce(b, mod, modLen, inv);
-
-        // Set t to high half of b
-        int[] t = new int[modLen];
-        for(int i=0; i<modLen; i++)
-            t[i] = b[i];
-
-        // Fill in the table with odd powers of the base
-        for (int i=1; i<tblmask; i++) {
-            int[] prod = multiplyToLen(t, modLen, table[i-1], modLen, null);
-            table[i] = montReduce(prod, mod, modLen, inv);
-        }
-
-        // Pre load the window that slides over the exponent
-        int bitpos = 1 << ((ebits-1) & (32-1));
-
-        int buf = 0;
-        int elen = exp.length;
-        int eIndex = 0;
-        for (int i = 0; i <= wbits; i++) {
-            buf = (buf << 1) | (((exp[eIndex] & bitpos) != 0)?1:0);
-            bitpos >>>= 1;
-            if (bitpos == 0) {
-                eIndex++;
-                bitpos = 1 << (32-1);
-                elen--;
-            }
-        }
-
-        int multpos = ebits;
-
-        // The first iteration, which is hoisted out of the main loop
-        ebits--;
-        boolean isone = true;
-
-        multpos = ebits - wbits;
-        while ((buf & 1) == 0) {
-            buf >>>= 1;
-            multpos++;
-        }
-
-        int[] mult = table[buf >>> 1];
-
-        buf = 0;
-        if (multpos == ebits)
-            isone = false;
-
-        // The main loop
-        while(true) {
-            ebits--;
-            // Advance the window
-            buf <<= 1;
-
-            if (elen != 0) {
-                buf |= ((exp[eIndex] & bitpos) != 0) ? 1 : 0;
-                bitpos >>>= 1;
-                if (bitpos == 0) {
-                    eIndex++;
-                    bitpos = 1 << (32-1);
-                    elen--;
-                }
-            }
-
-            // Examine the window for pending multiplies
-            if ((buf & tblmask) != 0) {
-                multpos = ebits - wbits;
-                while ((buf & 1) == 0) {
-                    buf >>>= 1;
-                    multpos++;
-                }
-                mult = table[buf >>> 1];
-                buf = 0;
-            }
-
-            // Perform multiply
-            if (ebits == multpos) {
-                if (isone) {
-                    b = mult.clone();
-                    isone = false;
-                } else {
-                    t = b;
-                    a = multiplyToLen(t, modLen, mult, modLen, a);
-                    a = montReduce(a, mod, modLen, inv);
-                    t = a; a = b; b = t;
-                }
-            }
-
-            // Check if done
-            if (ebits == 0)
-                break;
-
-            // Square the input
-            if (!isone) {
-                t = b;
-                a = squareToLen(t, modLen, a);
-                a = montReduce(a, mod, modLen, inv);
-                t = a; a = b; b = t;
-            }
-        }
-
-        // Convert result out of Montgomery form and return
-        int[] t2 = new int[2*modLen];
-        for(int i=0; i<modLen; i++)
-            t2[i+modLen] = b[i];
-
-        b = montReduce(t2, mod, modLen, inv);
-
-        t2 = new int[modLen];
-        for(int i=0; i<modLen; i++)
-            t2[i] = b[i];
-
-        return new BigInteger(1, t2);
-    }
-
-    /**
-     * Montgomery reduce n, modulo mod.  This reduces modulo mod and divides
-     * by 2^(32*mlen). Adapted from Colin Plumb's C library.
-     */
-    private static int[] montReduce(int[] n, int[] mod, int mlen, int inv) {
-        int c=0;
-        int len = mlen;
-        int offset=0;
-
-        do {
-            int nEnd = n[n.length-1-offset];
-            int carry = mulAdd(n, mod, offset, mlen, inv * nEnd);
-            c += addOne(n, offset, mlen, carry);
-            offset++;
-        } while(--len > 0);
-
-        while(c>0)
-            c += subN(n, mod, mlen);
-
-        while (intArrayCmpToLen(n, mod, mlen) >= 0)
-            subN(n, mod, mlen);
-
-        return n;
-    }
-
-
-    /*
-     * Returns -1, 0 or +1 as big-endian unsigned int array arg1 is less than,
-     * equal to, or greater than arg2 up to length len.
-     */
-    private static int intArrayCmpToLen(int[] arg1, int[] arg2, int len) {
-        for (int i=0; i<len; i++) {
-            long b1 = arg1[i] & LONG_MASK;
-            long b2 = arg2[i] & LONG_MASK;
-            if (b1 < b2)
-                return -1;
-            if (b1 > b2)
-                return 1;
-        }
-        return 0;
-    }
-
-    /**
-     * Subtracts two numbers of same length, returning borrow.
-     */
-    private static int subN(int[] a, int[] b, int len) {
-        long sum = 0;
-
-        while(--len >= 0) {
-            sum = (a[len] & LONG_MASK) -
-                 (b[len] & LONG_MASK) + (sum >> 32);
-            a[len] = (int)sum;
-        }
-
-        return (int)(sum >> 32);
-    }
-
-    /**
-     * Multiply an array by one word k and add to result, return the carry
-     */
-    static int mulAdd(int[] out, int[] in, int offset, int len, int k) {
-        long kLong = k & LONG_MASK;
-        long carry = 0;
-
-        offset = out.length-offset - 1;
-        for (int j=len-1; j >= 0; j--) {
-            long product = (in[j] & LONG_MASK) * kLong +
-                           (out[offset] & LONG_MASK) + carry;
-            out[offset--] = (int)product;
-            carry = product >>> 32;
-        }
-        return (int)carry;
-    }
-
-    /**
-     * Add one word to the number a mlen words into a. Return the resulting
-     * carry.
-     */
-    static int addOne(int[] a, int offset, int mlen, int carry) {
-        offset = a.length-1-mlen-offset;
-        long t = (a[offset] & LONG_MASK) + (carry & LONG_MASK);
-
-        a[offset] = (int)t;
-        if ((t >>> 32) == 0)
-            return 0;
-        while (--mlen >= 0) {
-            if (--offset < 0) { // Carry out of number
-                return 1;
-            } else {
-                a[offset]++;
-                if (a[offset] != 0)
-                    return 0;
-            }
-        }
-        return 1;
-    }
-
-    /**
-     * Returns a BigInteger whose value is (this ** exponent) mod (2**p)
-     */
-    private BigInteger modPow2(BigInteger exponent, int p) {
-        /*
-         * Perform exponentiation using repeated squaring trick, chopping off
-         * high order bits as indicated by modulus.
-         */
-        BigInteger result = valueOf(1);
-        BigInteger baseToPow2 = this.mod2(p);
-        int expOffset = 0;
-
-        int limit = exponent.bitLength();
-
-        if (this.testBit(0))
-           limit = (p-1) < limit ? (p-1) : limit;
-
-        while (expOffset < limit) {
-            if (exponent.testBit(expOffset))
-                result = result.multiply(baseToPow2).mod2(p);
-            expOffset++;
-            if (expOffset < limit)
-                baseToPow2 = baseToPow2.square().mod2(p);
-        }
-
-        return result;
-    }
-
-    /**
-     * Returns a BigInteger whose value is this mod(2**p).
-     * Assumes that this {@code BigInteger >= 0} and {@code p > 0}.
-     */
-    private BigInteger mod2(int p) {
-        if (bitLength() <= p)
-            return this;
-
-        // Copy remaining ints of mag
-        int numInts = (p + 31) >>> 5;
-        int[] mag = new int[numInts];
-        for (int i=0; i<numInts; i++)
-            mag[i] = this.mag[i + (this.mag.length - numInts)];
-
-        // Mask out any excess bits
-        int excessBits = (numInts << 5) - p;
-        mag[0] &= (1L << (32-excessBits)) - 1;
-
-        return (mag[0]==0 ? new BigInteger(1, mag) : new BigInteger(mag, 1));
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this}<sup>-1</sup> {@code mod m)}.
-     *
-     * @param  m the modulus.
-     * @return {@code this}<sup>-1</sup> {@code mod m}.
-     * @throws ArithmeticException {@code  m} &le; 0, or this BigInteger
-     *         has no multiplicative inverse mod m (that is, this BigInteger
-     *         is not <i>relatively prime</i> to m).
-     */
-    public BigInteger modInverse(BigInteger m) {
-        if (m.signum != 1)
-            throw new ArithmeticException("BigInteger: modulus not positive");
-
-        if (m.equals(ONE))
-            return ZERO;
-
-        // Calculate (this mod m)
-        BigInteger modVal = this;
-        if (signum < 0 || (this.compareMagnitude(m) >= 0))
-            modVal = this.mod(m);
-
-        if (modVal.equals(ONE))
-            return ONE;
-
-        MutableBigInteger a = new MutableBigInteger(modVal);
-        MutableBigInteger b = new MutableBigInteger(m);
-
-        MutableBigInteger result = a.mutableModInverse(b);
-        return result.toBigInteger(1);
-    }
-
-    // Shift Operations
-
-    /**
-     * Returns a BigInteger whose value is {@code (this << n)}.
-     * The shift distance, {@code n}, may be negative, in which case
-     * this method performs a right shift.
-     * (Computes <tt>floor(this * 2<sup>n</sup>)</tt>.)
-     *
-     * @param  n shift distance, in bits.
-     * @return {@code this << n}
-     * @throws ArithmeticException if the shift distance is {@code
-     *         Integer.MIN_VALUE}.
-     * @see #shiftRight
-     */
-    public BigInteger shiftLeft(int n) {
-        if (signum == 0)
-            return ZERO;
-        if (n==0)
-            return this;
-        if (n<0) {
-            if (n == Integer.MIN_VALUE) {
-                throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
-            } else {
-                return shiftRight(-n);
-            }
-        }
-
-        int nInts = n >>> 5;
-        int nBits = n & 0x1f;
-        int magLen = mag.length;
-        int newMag[] = null;
-
-        if (nBits == 0) {
-            newMag = new int[magLen + nInts];
-            for (int i=0; i<magLen; i++)
-                newMag[i] = mag[i];
-        } else {
-            int i = 0;
-            int nBits2 = 32 - nBits;
-            int highBits = mag[0] >>> nBits2;
-            if (highBits != 0) {
-                newMag = new int[magLen + nInts + 1];
-                newMag[i++] = highBits;
-            } else {
-                newMag = new int[magLen + nInts];
-            }
-            int j=0;
-            while (j < magLen-1)
-                newMag[i++] = mag[j++] << nBits | mag[j] >>> nBits2;
-            newMag[i] = mag[j] << nBits;
-        }
-
-        return new BigInteger(newMag, signum);
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this >> n)}.  Sign
-     * extension is performed.  The shift distance, {@code n}, may be
-     * negative, in which case this method performs a left shift.
-     * (Computes <tt>floor(this / 2<sup>n</sup>)</tt>.)
-     *
-     * @param  n shift distance, in bits.
-     * @return {@code this >> n}
-     * @throws ArithmeticException if the shift distance is {@code
-     *         Integer.MIN_VALUE}.
-     * @see #shiftLeft
-     */
-    public BigInteger shiftRight(int n) {
-        if (n==0)
-            return this;
-        if (n<0) {
-            if (n == Integer.MIN_VALUE) {
-                throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
-            } else {
-                return shiftLeft(-n);
-            }
-        }
-
-        int nInts = n >>> 5;
-        int nBits = n & 0x1f;
-        int magLen = mag.length;
-        int newMag[] = null;
-
-        // Special case: entire contents shifted off the end
-        if (nInts >= magLen)
-            return (signum >= 0 ? ZERO : negConst[1]);
-
-        if (nBits == 0) {
-            int newMagLen = magLen - nInts;
-            newMag = new int[newMagLen];
-            for (int i=0; i<newMagLen; i++)
-                newMag[i] = mag[i];
-        } else {
-            int i = 0;
-            int highBits = mag[0] >>> nBits;
-            if (highBits != 0) {
-                newMag = new int[magLen - nInts];
-                newMag[i++] = highBits;
-            } else {
-                newMag = new int[magLen - nInts -1];
-            }
-
-            int nBits2 = 32 - nBits;
-            int j=0;
-            while (j < magLen - nInts - 1)
-                newMag[i++] = (mag[j++] << nBits2) | (mag[j] >>> nBits);
-        }
-
-        if (signum < 0) {
-            // Find out whether any one-bits were shifted off the end.
-            boolean onesLost = false;
-            for (int i=magLen-1, j=magLen-nInts; i>=j && !onesLost; i--)
-                onesLost = (mag[i] != 0);
-            if (!onesLost && nBits != 0)
-                onesLost = (mag[magLen - nInts - 1] << (32 - nBits) != 0);
-
-            if (onesLost)
-                newMag = javaIncrement(newMag);
-        }
-
-        return new BigInteger(newMag, signum);
-    }
-
-    int[] javaIncrement(int[] val) {
-        int lastSum = 0;
-        for (int i=val.length-1;  i >= 0 && lastSum == 0; i--)
-            lastSum = (val[i] += 1);
-        if (lastSum == 0) {
-            val = new int[val.length+1];
-            val[0] = 1;
-        }
-        return val;
-    }
-
-    // Bitwise Operations
-
-    /**
-     * Returns a BigInteger whose value is {@code (this & val)}.  (This
-     * method returns a negative BigInteger if and only if this and val are
-     * both negative.)
-     *
-     * @param val value to be AND'ed with this BigInteger.
-     * @return {@code this & val}
-     */
-    public BigInteger and(BigInteger val) {
-        int[] result = new int[Math.max(intLength(), val.intLength())];
-        for (int i=0; i<result.length; i++)
-            result[i] = (getInt(result.length-i-1)
-                         & val.getInt(result.length-i-1));
-
-        return valueOf(result);
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this | val)}.  (This method
-     * returns a negative BigInteger if and only if either this or val is
-     * negative.)
-     *
-     * @param val value to be OR'ed with this BigInteger.
-     * @return {@code this | val}
-     */
-    public BigInteger or(BigInteger val) {
-        int[] result = new int[Math.max(intLength(), val.intLength())];
-        for (int i=0; i<result.length; i++)
-            result[i] = (getInt(result.length-i-1)
-                         | val.getInt(result.length-i-1));
-
-        return valueOf(result);
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this ^ val)}.  (This method
-     * returns a negative BigInteger if and only if exactly one of this and
-     * val are negative.)
-     *
-     * @param val value to be XOR'ed with this BigInteger.
-     * @return {@code this ^ val}
-     */
-    public BigInteger xor(BigInteger val) {
-        int[] result = new int[Math.max(intLength(), val.intLength())];
-        for (int i=0; i<result.length; i++)
-            result[i] = (getInt(result.length-i-1)
-                         ^ val.getInt(result.length-i-1));
-
-        return valueOf(result);
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (~this)}.  (This method
-     * returns a negative value if and only if this BigInteger is
-     * non-negative.)
-     *
-     * @return {@code ~this}
-     */
-    public BigInteger not() {
-        int[] result = new int[intLength()];
-        for (int i=0; i<result.length; i++)
-            result[i] = ~getInt(result.length-i-1);
-
-        return valueOf(result);
-    }
-
-    /**
-     * Returns a BigInteger whose value is {@code (this & ~val)}.  This
-     * method, which is equivalent to {@code and(val.not())}, is provided as
-     * a convenience for masking operations.  (This method returns a negative
-     * BigInteger if and only if {@code this} is negative and {@code val} is
-     * positive.)
-     *
-     * @param val value to be complemented and AND'ed with this BigInteger.
-     * @return {@code this & ~val}
-     */
-    public BigInteger andNot(BigInteger val) {
-        int[] result = new int[Math.max(intLength(), val.intLength())];
-        for (int i=0; i<result.length; i++)
-            result[i] = (getInt(result.length-i-1)
-                         & ~val.getInt(result.length-i-1));
-
-        return valueOf(result);
-    }
-
-
-    // Single Bit Operations
-
-    /**
-     * Returns {@code true} if and only if the designated bit is set.
-     * (Computes {@code ((this & (1<<n)) != 0)}.)
-     *
-     * @param  n index of bit to test.
-     * @return {@code true} if and only if the designated bit is set.
-     * @throws ArithmeticException {@code n} is negative.
-     */
-    public boolean testBit(int n) {
-        if (n<0)
-            throw new ArithmeticException("Negative bit address");
-
-        return (getInt(n >>> 5) & (1 << (n & 31))) != 0;
-    }
-
-    /**
-     * Returns a BigInteger whose value is equivalent to this BigInteger
-     * with the designated bit set.  (Computes {@code (this | (1<<n))}.)
-     *
-     * @param  n index of bit to set.
-     * @return {@code this | (1<<n)}
-     * @throws ArithmeticException {@code n} is negative.
-     */
-    public BigInteger setBit(int n) {
-        if (n<0)
-            throw new ArithmeticException("Negative bit address");
-
-        int intNum = n >>> 5;
-        int[] result = new int[Math.max(intLength(), intNum+2)];
-
-        for (int i=0; i<result.length; i++)
-            result[result.length-i-1] = getInt(i);
-
-        result[result.length-intNum-1] |= (1 << (n & 31));
-
-        return valueOf(result);
-    }
-
-    /**
-     * Returns a BigInteger whose value is equivalent to this BigInteger
-     * with the designated bit cleared.
-     * (Computes {@code (this & ~(1<<n))}.)
-     *
-     * @param  n index of bit to clear.
-     * @return {@code this & ~(1<<n)}
-     * @throws ArithmeticException {@code n} is negative.
-     */
-    public BigInteger clearBit(int n) {
-        if (n<0)
-            throw new ArithmeticException("Negative bit address");
-
-        int intNum = n >>> 5;
-        int[] result = new int[Math.max(intLength(), ((n + 1) >>> 5) + 1)];
-
-        for (int i=0; i<result.length; i++)
-            result[result.length-i-1] = getInt(i);
-
-        result[result.length-intNum-1] &= ~(1 << (n & 31));
-
-        return valueOf(result);
-    }
-
-    /**
-     * Returns a BigInteger whose value is equivalent to this BigInteger
-     * with the designated bit flipped.
-     * (Computes {@code (this ^ (1<<n))}.)
-     *
-     * @param  n index of bit to flip.
-     * @return {@code this ^ (1<<n)}
-     * @throws ArithmeticException {@code n} is negative.
-     */
-    public BigInteger flipBit(int n) {
-        if (n<0)
-            throw new ArithmeticException("Negative bit address");
-
-        int intNum = n >>> 5;
-        int[] result = new int[Math.max(intLength(), intNum+2)];
-
-        for (int i=0; i<result.length; i++)
-            result[result.length-i-1] = getInt(i);
-
-        result[result.length-intNum-1] ^= (1 << (n & 31));
-
-        return valueOf(result);
-    }
-
-    /**
-     * Returns the index of the rightmost (lowest-order) one bit in this
-     * BigInteger (the number of zero bits to the right of the rightmost
-     * one bit).  Returns -1 if this BigInteger contains no one bits.
-     * (Computes {@code (this==0? -1 : log2(this & -this))}.)
-     *
-     * @return index of the rightmost one bit in this BigInteger.
-     */
-    public int getLowestSetBit() {
-        @SuppressWarnings("deprecation") int lsb = lowestSetBit - 2;
-        if (lsb == -2) {  // lowestSetBit not initialized yet
-            lsb = 0;
-            if (signum == 0) {
-                lsb -= 1;
-            } else {
-                // Search for lowest order nonzero int
-                int i,b;
-                for (i=0; (b = getInt(i))==0; i++)
-                    ;
-                lsb += (i << 5) + Integer.numberOfTrailingZeros(b);
-            }
-            lowestSetBit = lsb + 2;
-        }
-        return lsb;
-    }
-
-
-    // Miscellaneous Bit Operations
-
-    /**
-     * Returns the number of bits in the minimal two's-complement
-     * representation of this BigInteger, <i>excluding</i> a sign bit.
-     * For positive BigIntegers, this is equivalent to the number of bits in
-     * the ordinary binary representation.  (Computes
-     * {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
-     *
-     * @return number of bits in the minimal two's-complement
-     *         representation of this BigInteger, <i>excluding</i> a sign bit.
-     */
-    public int bitLength() {
-        @SuppressWarnings("deprecation") int n = bitLength - 1;
-        if (n == -1) { // bitLength not initialized yet
-            int[] m = mag;
-            int len = m.length;
-            if (len == 0) {
-                n = 0; // offset by one to initialize
-            }  else {
-                // Calculate the bit length of the magnitude
-                int magBitLength = ((len - 1) << 5) + bitLengthForInt(mag[0]);
-                 if (signum < 0) {
-                     // Check if magnitude is a power of two
-                     boolean pow2 = (Integer.bitCount(mag[0]) == 1);
-                     for(int i=1; i< len && pow2; i++)
-                         pow2 = (mag[i] == 0);
-
-                     n = (pow2 ? magBitLength -1 : magBitLength);
-                 } else {
-                     n = magBitLength;
-                 }
-            }
-            bitLength = n + 1;
-        }
-        return n;
-    }
-
-    /**
-     * Returns the number of bits in the two's complement representation
-     * of this BigInteger that differ from its sign bit.  This method is
-     * useful when implementing bit-vector style sets atop BigIntegers.
-     *
-     * @return number of bits in the two's complement representation
-     *         of this BigInteger that differ from its sign bit.
-     */
-    public int bitCount() {
-        @SuppressWarnings("deprecation") int bc = bitCount - 1;
-        if (bc == -1) {  // bitCount not initialized yet
-            bc = 0;      // offset by one to initialize
-            // Count the bits in the magnitude
-            for (int i=0; i<mag.length; i++)
-                bc += Integer.bitCount(mag[i]);
-            if (signum < 0) {
-                // Count the trailing zeros in the magnitude
-                int magTrailingZeroCount = 0, j;
-                for (j=mag.length-1; mag[j]==0; j--)
-                    magTrailingZeroCount += 32;
-                magTrailingZeroCount += Integer.numberOfTrailingZeros(mag[j]);
-                bc += magTrailingZeroCount - 1;
-            }
-            bitCount = bc + 1;
-        }
-        return bc;
-    }
-
-    // Primality Testing
-
-    /**
-     * Returns {@code true} if this BigInteger is probably prime,
-     * {@code false} if it's definitely composite.  If
-     * {@code certainty} is &le; 0, {@code true} is
-     * returned.
-     *
-     * @param  certainty a measure of the uncertainty that the caller is
-     *         willing to tolerate: if the call returns {@code true}
-     *         the probability that this BigInteger is prime exceeds
-     *         (1 - 1/2<sup>{@code certainty}</sup>).  The execution time of
-     *         this method is proportional to the value of this parameter.
-     * @return {@code true} if this BigInteger is probably prime,
-     *         {@code false} if it's definitely composite.
-     */
-    public boolean isProbablePrime(int certainty) {
-        if (certainty <= 0)
-            return true;
-        BigInteger w = this.abs();
-        if (w.equals(TWO))
-            return true;
-        if (!w.testBit(0) || w.equals(ONE))
-            return false;
-
-        return w.primeToCertainty(certainty, null);
-    }
-
-    // Comparison Operations
-
-    /**
-     * Compares this BigInteger with the specified BigInteger.  This
-     * method is provided in preference to individual methods for each
-     * of the six boolean comparison operators ({@literal <}, ==,
-     * {@literal >}, {@literal >=}, !=, {@literal <=}).  The suggested
-     * idiom for performing these comparisons is: {@code
-     * (x.compareTo(y)} &lt;<i>op</i>&gt; {@code 0)}, where
-     * &lt;<i>op</i>&gt; is one of the six comparison operators.
-     *
-     * @param  val BigInteger to which this BigInteger is to be compared.
-     * @return -1, 0 or 1 as this BigInteger is numerically less than, equal
-     *         to, or greater than {@code val}.
-     */
-    public int compareTo(BigInteger val) {
-        if (signum == val.signum) {
-            switch (signum) {
-            case 1:
-                return compareMagnitude(val);
-            case -1:
-                return val.compareMagnitude(this);
-            default:
-                return 0;
-            }
-        }
-        return signum > val.signum ? 1 : -1;
-    }
-
-    /**
-     * Compares the magnitude array of this BigInteger with the specified
-     * BigInteger's. This is the version of compareTo ignoring sign.
-     *
-     * @param val BigInteger whose magnitude array to be compared.
-     * @return -1, 0 or 1 as this magnitude array is less than, equal to or
-     *         greater than the magnitude aray for the specified BigInteger's.
-     */
-    final int compareMagnitude(BigInteger val) {
-        int[] m1 = mag;
-        int len1 = m1.length;
-        int[] m2 = val.mag;
-        int len2 = m2.length;
-        if (len1 < len2)
-            return -1;
-        if (len1 > len2)
-            return 1;
-        for (int i = 0; i < len1; i++) {
-            int a = m1[i];
-            int b = m2[i];
-            if (a != b)
-                return ((a & LONG_MASK) < (b & LONG_MASK)) ? -1 : 1;
-        }
-        return 0;
-    }
-
-    /**
-     * Compares this BigInteger with the specified Object for equality.
-     *
-     * @param  x Object to which this BigInteger is to be compared.
-     * @return {@code true} if and only if the specified Object is a
-     *         BigInteger whose value is numerically equal to this BigInteger.
-     */
-    public boolean equals(Object x) {
-        // This test is just an optimization, which may or may not help
-        if (x == this)
-            return true;
-
-        if (!(x instanceof BigInteger))
-            return false;
-
-        BigInteger xInt = (BigInteger) x;
-        if (xInt.signum != signum)
-            return false;
-
-        int[] m = mag;
-        int len = m.length;
-        int[] xm = xInt.mag;
-        if (len != xm.length)
-            return false;
-
-        for (int i = 0; i < len; i++)
-            if (xm[i] != m[i])
-                return false;
-
-        return true;
-    }
-
-    /**
-     * Returns the minimum of this BigInteger and {@code val}.
-     *
-     * @param  val value with which the minimum is to be computed.
-     * @return the BigInteger whose value is the lesser of this BigInteger and
-     *         {@code val}.  If they are equal, either may be returned.
-     */
-    public BigInteger min(BigInteger val) {
-        return (compareTo(val)<0 ? this : val);
-    }
-
-    /**
-     * Returns the maximum of this BigInteger and {@code val}.
-     *
-     * @param  val value with which the maximum is to be computed.
-     * @return the BigInteger whose value is the greater of this and
-     *         {@code val}.  If they are equal, either may be returned.
-     */
-    public BigInteger max(BigInteger val) {
-        return (compareTo(val)>0 ? this : val);
-    }
-
-
-    // Hash Function
-
-    /**
-     * Returns the hash code for this BigInteger.
-     *
-     * @return hash code for this BigInteger.
-     */
-    public int hashCode() {
-        int hashCode = 0;
-
-        for (int i=0; i<mag.length; i++)
-            hashCode = (int)(31*hashCode + (mag[i] & LONG_MASK));
-
-        return hashCode * signum;
-    }
-
-    /**
-     * Returns the String representation of this BigInteger in the
-     * given radix.  If the radix is outside the range from {@link
-     * Character#MIN_RADIX} to {@link Character#MAX_RADIX} inclusive,
-     * it will default to 10 (as is the case for
-     * {@code Integer.toString}).  The digit-to-character mapping
-     * provided by {@code Character.forDigit} is used, and a minus
-     * sign is prepended if appropriate.  (This representation is
-     * compatible with the {@link #BigInteger(String, int) (String,
-     * int)} constructor.)
-     *
-     * @param  radix  radix of the String representation.
-     * @return String representation of this BigInteger in the given radix.
-     * @see    Integer#toString
-     * @see    Character#forDigit
-     * @see    #BigInteger(java.lang.String, int)
-     */
-    public String toString(int radix) {
-        if (signum == 0)
-            return "0";
-        if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
-            radix = 10;
-
-        // Compute upper bound on number of digit groups and allocate space
-        int maxNumDigitGroups = (4*mag.length + 6)/7;
-        String digitGroup[] = new String[maxNumDigitGroups];
-
-        // Translate number to string, a digit group at a time
-        BigInteger tmp = this.abs();
-        int numGroups = 0;
-        while (tmp.signum != 0) {
-            BigInteger d = longRadix[radix];
-
-            MutableBigInteger q = new MutableBigInteger(),
-                              a = new MutableBigInteger(tmp.mag),
-                              b = new MutableBigInteger(d.mag);
-            MutableBigInteger r = a.divide(b, q);
-            BigInteger q2 = q.toBigInteger(tmp.signum * d.signum);
-            BigInteger r2 = r.toBigInteger(tmp.signum * d.signum);
-
-            digitGroup[numGroups++] = Long.toString(r2.longValue(), radix);
-            tmp = q2;
-        }
-
-        // Put sign (if any) and first digit group into result buffer
-        StringBuilder buf = new StringBuilder(numGroups*digitsPerLong[radix]+1);
-        if (signum<0)
-            buf.append('-');
-        buf.append(digitGroup[numGroups-1]);
-
-        // Append remaining digit groups padded with leading zeros
-        for (int i=numGroups-2; i>=0; i--) {
-            // Prepend (any) leading zeros for this digit group
-            int numLeadingZeros = digitsPerLong[radix]-digitGroup[i].length();
-            if (numLeadingZeros != 0)
-                buf.append(zeros[numLeadingZeros]);
-            buf.append(digitGroup[i]);
-        }
-        return buf.toString();
-    }
-
-    /* zero[i] is a string of i consecutive zeros. */
-    private static String zeros[] = new String[64];
-    static {
-        zeros[63] =
-            "000000000000000000000000000000000000000000000000000000000000000";
-        for (int i=0; i<63; i++)
-            zeros[i] = zeros[63].substring(0, i);
-    }
-
-    /**
-     * Returns the decimal String representation of this BigInteger.
-     * The digit-to-character mapping provided by
-     * {@code Character.forDigit} is used, and a minus sign is
-     * prepended if appropriate.  (This representation is compatible
-     * with the {@link #BigInteger(String) (String)} constructor, and
-     * allows for String concatenation with Java's + operator.)
-     *
-     * @return decimal String representation of this BigInteger.
-     * @see    Character#forDigit
-     * @see    #BigInteger(java.lang.String)
-     */
-    public String toString() {
-        return toString(10);
-    }
-
-    /**
-     * Returns a byte array containing the two's-complement
-     * representation of this BigInteger.  The byte array will be in
-     * <i>big-endian</i> byte-order: the most significant byte is in
-     * the zeroth element.  The array will contain the minimum number
-     * of bytes required to represent this BigInteger, including at
-     * least one sign bit, which is {@code (ceil((this.bitLength() +
-     * 1)/8))}.  (This representation is compatible with the
-     * {@link #BigInteger(byte[]) (byte[])} constructor.)
-     *
-     * @return a byte array containing the two's-complement representation of
-     *         this BigInteger.
-     * @see    #BigInteger(byte[])
-     */
-    public byte[] toByteArray() {
-        int byteLen = bitLength()/8 + 1;
-        byte[] byteArray = new byte[byteLen];
-
-        for (int i=byteLen-1, bytesCopied=4, nextInt=0, intIndex=0; i>=0; i--) {
-            if (bytesCopied == 4) {
-                nextInt = getInt(intIndex++);
-                bytesCopied = 1;
-            } else {
-                nextInt >>>= 8;
-                bytesCopied++;
-            }
-            byteArray[i] = (byte)nextInt;
-        }
-        return byteArray;
-    }
-
-    /**
-     * Converts this BigInteger to an {@code int}.  This
-     * conversion is analogous to a
-     * <i>narrowing primitive conversion</i> from {@code long} to
-     * {@code int} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * if this BigInteger is too big to fit in an
-     * {@code int}, only the low-order 32 bits are returned.
-     * Note that this conversion can lose information about the
-     * overall magnitude of the BigInteger value as well as return a
-     * result with the opposite sign.
-     *
-     * @return this BigInteger converted to an {@code int}.
-     */
-    public int intValue() {
-        int result = 0;
-        result = getInt(0);
-        return result;
-    }
-
-    /**
-     * Converts this BigInteger to a {@code long}.  This
-     * conversion is analogous to a
-     * <i>narrowing primitive conversion</i> from {@code long} to
-     * {@code int} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * if this BigInteger is too big to fit in a
-     * {@code long}, only the low-order 64 bits are returned.
-     * Note that this conversion can lose information about the
-     * overall magnitude of the BigInteger value as well as return a
-     * result with the opposite sign.
-     *
-     * @return this BigInteger converted to a {@code long}.
-     */
-    public long longValue() {
-        long result = 0;
-
-        for (int i=1; i>=0; i--)
-            result = (result << 32) + (getInt(i) & LONG_MASK);
-        return result;
-    }
-
-    /**
-     * Converts this BigInteger to a {@code float}.  This
-     * conversion is similar to the
-     * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * if this BigInteger has too great a magnitude
-     * to represent as a {@code float}, it will be converted to
-     * {@link Float#NEGATIVE_INFINITY} or {@link
-     * Float#POSITIVE_INFINITY} as appropriate.  Note that even when
-     * the return value is finite, this conversion can lose
-     * information about the precision of the BigInteger value.
-     *
-     * @return this BigInteger converted to a {@code float}.
-     */
-    public float floatValue() {
-        // Somewhat inefficient, but guaranteed to work.
-        return Float.parseFloat(this.toString());
-    }
-
-    /**
-     * Converts this BigInteger to a {@code double}.  This
-     * conversion is similar to the
-     * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
-     * <cite>The Java&trade; Language Specification</cite>:
-     * if this BigInteger has too great a magnitude
-     * to represent as a {@code double}, it will be converted to
-     * {@link Double#NEGATIVE_INFINITY} or {@link
-     * Double#POSITIVE_INFINITY} as appropriate.  Note that even when
-     * the return value is finite, this conversion can lose
-     * information about the precision of the BigInteger value.
-     *
-     * @return this BigInteger converted to a {@code double}.
-     */
-    public double doubleValue() {
-        // Somewhat inefficient, but guaranteed to work.
-        return Double.parseDouble(this.toString());
-    }
-
-    /**
-     * Returns a copy of the input array stripped of any leading zero bytes.
-     */
-    private static int[] stripLeadingZeroInts(int val[]) {
-        int vlen = val.length;
-        int keep;
-
-        // Find first nonzero byte
-        for (keep = 0; keep < vlen && val[keep] == 0; keep++)
-            ;
-        return java.util.Arrays.copyOfRange(val, keep, vlen);
-    }
-
-    /**
-     * Returns the input array stripped of any leading zero bytes.
-     * Since the source is trusted the copying may be skipped.
-     */
-    private static int[] trustedStripLeadingZeroInts(int val[]) {
-        int vlen = val.length;
-        int keep;
-
-        // Find first nonzero byte
-        for (keep = 0; keep < vlen && val[keep] == 0; keep++)
-            ;
-        return keep == 0 ? val : java.util.Arrays.copyOfRange(val, keep, vlen);
-    }
-
-    /**
-     * Returns a copy of the input array stripped of any leading zero bytes.
-     */
-    private static int[] stripLeadingZeroBytes(byte a[]) {
-        int byteLength = a.length;
-        int keep;
-
-        // Find first nonzero byte
-        for (keep = 0; keep < byteLength && a[keep]==0; keep++)
-            ;
-
-        // Allocate new array and copy relevant part of input array
-        int intLength = ((byteLength - keep) + 3) >>> 2;
-        int[] result = new int[intLength];
-        int b = byteLength - 1;
-        for (int i = intLength-1; i >= 0; i--) {
-            result[i] = a[b--] & 0xff;
-            int bytesRemaining = b - keep + 1;
-            int bytesToTransfer = Math.min(3, bytesRemaining);
-            for (int j=8; j <= (bytesToTransfer << 3); j += 8)
-                result[i] |= ((a[b--] & 0xff) << j);
-        }
-        return result;
-    }
-
-    /**
-     * Takes an array a representing a negative 2's-complement number and
-     * returns the minimal (no leading zero bytes) unsigned whose value is -a.
-     */
-    private static int[] makePositive(byte a[]) {
-        int keep, k;
-        int byteLength = a.length;
-
-        // Find first non-sign (0xff) byte of input
-        for (keep=0; keep<byteLength && a[keep]==-1; keep++)
-            ;
-
-
-        /* Allocate output array.  If all non-sign bytes are 0x00, we must
-         * allocate space for one extra output byte. */
-        for (k=keep; k<byteLength && a[k]==0; k++)
-            ;
-
-        int extraByte = (k==byteLength) ? 1 : 0;
-        int intLength = ((byteLength - keep + extraByte) + 3)/4;
-        int result[] = new int[intLength];
-
-        /* Copy one's complement of input into output, leaving extra
-         * byte (if it exists) == 0x00 */
-        int b = byteLength - 1;
-        for (int i = intLength-1; i >= 0; i--) {
-            result[i] = a[b--] & 0xff;
-            int numBytesToTransfer = Math.min(3, b-keep+1);
-            if (numBytesToTransfer < 0)
-                numBytesToTransfer = 0;
-            for (int j=8; j <= 8*numBytesToTransfer; j += 8)
-                result[i] |= ((a[b--] & 0xff) << j);
-
-            // Mask indicates which bits must be complemented
-            int mask = -1 >>> (8*(3-numBytesToTransfer));
-            result[i] = ~result[i] & mask;
-        }
-
-        // Add one to one's complement to generate two's complement
-        for (int i=result.length-1; i>=0; i--) {
-            result[i] = (int)((result[i] & LONG_MASK) + 1);
-            if (result[i] != 0)
-                break;
-        }
-
-        return result;
-    }
-
-    /**
-     * Takes an array a representing a negative 2's-complement number and
-     * returns the minimal (no leading zero ints) unsigned whose value is -a.
-     */
-    private static int[] makePositive(int a[]) {
-        int keep, j;
-
-        // Find first non-sign (0xffffffff) int of input
-        for (keep=0; keep<a.length && a[keep]==-1; keep++)
-            ;
-
-        /* Allocate output array.  If all non-sign ints are 0x00, we must
-         * allocate space for one extra output int. */
-        for (j=keep; j<a.length && a[j]==0; j++)
-            ;
-        int extraInt = (j==a.length ? 1 : 0);
-        int result[] = new int[a.length - keep + extraInt];
-
-        /* Copy one's complement of input into output, leaving extra
-         * int (if it exists) == 0x00 */
-        for (int i = keep; i<a.length; i++)
-            result[i - keep + extraInt] = ~a[i];
-
-        // Add one to one's complement to generate two's complement
-        for (int i=result.length-1; ++result[i]==0; i--)
-            ;
-
-        return result;
-    }
-
-    /*
-     * The following two arrays are used for fast String conversions.  Both
-     * are indexed by radix.  The first is the number of digits of the given
-     * radix that can fit in a Java long without "going negative", i.e., the
-     * highest integer n such that radix**n < 2**63.  The second is the
-     * "long radix" that tears each number into "long digits", each of which
-     * consists of the number of digits in the corresponding element in
-     * digitsPerLong (longRadix[i] = i**digitPerLong[i]).  Both arrays have
-     * nonsense values in their 0 and 1 elements, as radixes 0 and 1 are not
-     * used.
-     */
-    private static int digitsPerLong[] = {0, 0,
-        62, 39, 31, 27, 24, 22, 20, 19, 18, 18, 17, 17, 16, 16, 15, 15, 15, 14,
-        14, 14, 14, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12};
-
-    private static BigInteger longRadix[] = {null, null,
-        valueOf(0x4000000000000000L), valueOf(0x383d9170b85ff80bL),
-        valueOf(0x4000000000000000L), valueOf(0x6765c793fa10079dL),
-        valueOf(0x41c21cb8e1000000L), valueOf(0x3642798750226111L),
-        valueOf(0x1000000000000000L), valueOf(0x12bf307ae81ffd59L),
-        valueOf( 0xde0b6b3a7640000L), valueOf(0x4d28cb56c33fa539L),
-        valueOf(0x1eca170c00000000L), valueOf(0x780c7372621bd74dL),
-        valueOf(0x1e39a5057d810000L), valueOf(0x5b27ac993df97701L),
-        valueOf(0x1000000000000000L), valueOf(0x27b95e997e21d9f1L),
-        valueOf(0x5da0e1e53c5c8000L), valueOf( 0xb16a458ef403f19L),
-        valueOf(0x16bcc41e90000000L), valueOf(0x2d04b7fdd9c0ef49L),
-        valueOf(0x5658597bcaa24000L), valueOf( 0x6feb266931a75b7L),
-        valueOf( 0xc29e98000000000L), valueOf(0x14adf4b7320334b9L),
-        valueOf(0x226ed36478bfa000L), valueOf(0x383d9170b85ff80bL),
-        valueOf(0x5a3c23e39c000000L), valueOf( 0x4e900abb53e6b71L),
-        valueOf( 0x7600ec618141000L), valueOf( 0xaee5720ee830681L),
-        valueOf(0x1000000000000000L), valueOf(0x172588ad4f5f0981L),
-        valueOf(0x211e44f7d02c1000L), valueOf(0x2ee56725f06e5c71L),
-        valueOf(0x41c21cb8e1000000L)};
-
-    /*
-     * These two arrays are the integer analogue of above.
-     */
-    private static int digitsPerInt[] = {0, 0, 30, 19, 15, 13, 11,
-        11, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6,
-        6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5};
-
-    private static int intRadix[] = {0, 0,
-        0x40000000, 0x4546b3db, 0x40000000, 0x48c27395, 0x159fd800,
-        0x75db9c97, 0x40000000, 0x17179149, 0x3b9aca00, 0xcc6db61,
-        0x19a10000, 0x309f1021, 0x57f6c100, 0xa2f1b6f,  0x10000000,
-        0x18754571, 0x247dbc80, 0x3547667b, 0x4c4b4000, 0x6b5a6e1d,
-        0x6c20a40,  0x8d2d931,  0xb640000,  0xe8d4a51,  0x1269ae40,
-        0x17179149, 0x1cb91000, 0x23744899, 0x2b73a840, 0x34e63b41,
-        0x40000000, 0x4cfa3cc1, 0x5c13d840, 0x6d91b519, 0x39aa400
-    };
-
-    /**
-     * These routines provide access to the two's complement representation
-     * of BigIntegers.
-     */
-
-    /**
-     * Returns the length of the two's complement representation in ints,
-     * including space for at least one sign bit.
-     */
-    private int intLength() {
-        return (bitLength() >>> 5) + 1;
-    }
-
-    /* Returns sign bit */
-    private int signBit() {
-        return signum < 0 ? 1 : 0;
-    }
-
-    /* Returns an int of sign bits */
-    private int signInt() {
-        return signum < 0 ? -1 : 0;
-    }
-
-    /**
-     * Returns the specified int of the little-endian two's complement
-     * representation (int 0 is the least significant).  The int number can
-     * be arbitrarily high (values are logically preceded by infinitely many
-     * sign ints).
-     */
-    private int getInt(int n) {
-        if (n < 0)
-            return 0;
-        if (n >= mag.length)
-            return signInt();
-
-        int magInt = mag[mag.length-n-1];
-
-        return (signum >= 0 ? magInt :
-                (n <= firstNonzeroIntNum() ? -magInt : ~magInt));
-    }
-
-    /**
-     * Returns the index of the int that contains the first nonzero int in the
-     * little-endian binary representation of the magnitude (int 0 is the
-     * least significant). If the magnitude is zero, return value is undefined.
-     */
-     private int firstNonzeroIntNum() {
-         int fn = firstNonzeroIntNum - 2;
-         if (fn == -2) { // firstNonzeroIntNum not initialized yet
-             fn = 0;
-
-             // Search for the first nonzero int
-             int i;
-             int mlen = mag.length;
-             for (i = mlen - 1; i >= 0 && mag[i] == 0; i--)
-                 ;
-             fn = mlen - i - 1;
-             firstNonzeroIntNum = fn + 2; // offset by two to initialize
-         }
-         return fn;
-     }
-
-    /** use serialVersionUID from JDK 1.1. for interoperability */
-    private static final long serialVersionUID = -8287574255936472291L;
-
-    /**
-     * Serializable fields for BigInteger.
-     *
-     * @serialField signum  int
-     *              signum of this BigInteger.
-     * @serialField magnitude int[]
-     *              magnitude array of this BigInteger.
-     * @serialField bitCount  int
-     *              number of bits in this BigInteger
-     * @serialField bitLength int
-     *              the number of bits in the minimal two's-complement
-     *              representation of this BigInteger
-     * @serialField lowestSetBit int
-     *              lowest set bit in the twos complement representation
-     */
-    private static final ObjectStreamField[] serialPersistentFields = {
-        new ObjectStreamField("signum", Integer.TYPE),
-        new ObjectStreamField("magnitude", byte[].class),
-        new ObjectStreamField("bitCount", Integer.TYPE),
-        new ObjectStreamField("bitLength", Integer.TYPE),
-        new ObjectStreamField("firstNonzeroByteNum", Integer.TYPE),
-        new ObjectStreamField("lowestSetBit", Integer.TYPE)
-        };
-
-    /**
-     * Reconstitute the {@code BigInteger} instance from a stream (that is,
-     * deserialize it). The magnitude is read in as an array of bytes
-     * for historical reasons, but it is converted to an array of ints
-     * and the byte array is discarded.
-     * Note:
-     * The current convention is to initialize the cache fields, bitCount,
-     * bitLength and lowestSetBit, to 0 rather than some other marker value.
-     * Therefore, no explicit action to set these fields needs to be taken in
-     * readObject because those fields already have a 0 value be default since
-     * defaultReadObject is not being used.
-     */
-    private void readObject(java.io.ObjectInputStream s)
-        throws java.io.IOException, ClassNotFoundException {
-        /*
-         * In order to maintain compatibility with previous serialized forms,
-         * the magnitude of a BigInteger is serialized as an array of bytes.
-         * The magnitude field is used as a temporary store for the byte array
-         * that is deserialized. The cached computation fields should be
-         * transient but are serialized for compatibility reasons.
-         */
-
-        // prepare to read the alternate persistent fields
-        ObjectInputStream.GetField fields = s.readFields();
-
-        // Read the alternate persistent fields that we care about
-        int sign = fields.get("signum", -2);
-        byte[] magnitude = (byte[])fields.get("magnitude", null);
-
-        // Validate signum
-        if (sign < -1 || sign > 1) {
-            String message = "BigInteger: Invalid signum value";
-            if (fields.defaulted("signum"))
-                message = "BigInteger: Signum not present in stream";
-            throw new java.io.StreamCorruptedException(message);
-        }
-        if ((magnitude.length == 0) != (sign == 0)) {
-            String message = "BigInteger: signum-magnitude mismatch";
-            if (fields.defaulted("magnitude"))
-                message = "BigInteger: Magnitude not present in stream";
-            throw new java.io.StreamCorruptedException(message);
-        }
-
-        // Commit final fields via Unsafe
-        unsafe.putIntVolatile(this, signumOffset, sign);
-
-        // Calculate mag field from magnitude and discard magnitude
-        unsafe.putObjectVolatile(this, magOffset,
-                                 stripLeadingZeroBytes(magnitude));
-    }
-
-    // Support for resetting final fields while deserializing
-    private static final sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
-    private static final long signumOffset;
-    private static final long magOffset;
-    static {
-        try {
-            signumOffset = unsafe.objectFieldOffset
-                (BigInteger.class.getDeclaredField("signum"));
-            magOffset = unsafe.objectFieldOffset
-                (BigInteger.class.getDeclaredField("mag"));
-        } catch (Exception ex) {
-            throw new Error(ex);
-        }
-    }
-
-    /**
-     * Save the {@code BigInteger} instance to a stream.
-     * The magnitude of a BigInteger is serialized as a byte array for
-     * historical reasons.
-     *
-     * @serialData two necessary fields are written as well as obsolete
-     *             fields for compatibility with older versions.
-     */
-    private void writeObject(ObjectOutputStream s) throws IOException {
-        // set the values of the Serializable fields
-        ObjectOutputStream.PutField fields = s.putFields();
-        fields.put("signum", signum);
-        fields.put("magnitude", magSerializedForm());
-        // The values written for cached fields are compatible with older
-        // versions, but are ignored in readObject so don't otherwise matter.
-        fields.put("bitCount", -1);
-        fields.put("bitLength", -1);
-        fields.put("lowestSetBit", -2);
-        fields.put("firstNonzeroByteNum", -2);
-
-        // save them
-        s.writeFields();
-}
-
-    /**
-     * Returns the mag array as an array of bytes.
-     */
-    private byte[] magSerializedForm() {
-        int len = mag.length;
-
-        int bitLen = (len == 0 ? 0 : ((len - 1) << 5) + bitLengthForInt(mag[0]));
-        int byteLen = (bitLen + 7) >>> 3;
-        byte[] result = new byte[byteLen];
-
-        for (int i = byteLen - 1, bytesCopied = 4, intIndex = len - 1, nextInt = 0;
-             i>=0; i--) {
-            if (bytesCopied == 4) {
-                nextInt = mag[intIndex--];
-                bytesCopied = 1;
-            } else {
-                nextInt >>>= 8;
-                bytesCopied++;
-            }
-            result[i] = (byte)nextInt;
-        }
-        return result;
-    }
-}
diff --git a/ojluni/src/main/java/java/math/BitSieve.java b/ojluni/src/main/java/java/math/BitSieve.java
deleted file mode 100755
index 8d0d370..0000000
--- a/ojluni/src/main/java/java/math/BitSieve.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.math;
-
-/**
- * A simple bit sieve used for finding prime number candidates. Allows setting
- * and clearing of bits in a storage array. The size of the sieve is assumed to
- * be constant to reduce overhead. All the bits of a new bitSieve are zero, and
- * bits are removed from it by setting them.
- *
- * To reduce storage space and increase efficiency, no even numbers are
- * represented in the sieve (each bit in the sieve represents an odd number).
- * The relationship between the index of a bit and the number it represents is
- * given by
- * N = offset + (2*index + 1);
- * Where N is the integer represented by a bit in the sieve, offset is some
- * even integer offset indicating where the sieve begins, and index is the
- * index of a bit in the sieve array.
- *
- * @see     BigInteger
- * @author  Michael McCloskey
- * @since   1.3
- */
-class BitSieve {
-    /**
-     * Stores the bits in this bitSieve.
-     */
-    private long bits[];
-
-    /**
-     * Length is how many bits this sieve holds.
-     */
-    private int length;
-
-    /**
-     * A small sieve used to filter out multiples of small primes in a search
-     * sieve.
-     */
-    private static BitSieve smallSieve = new BitSieve();
-
-    /**
-     * Construct a "small sieve" with a base of 0.  This constructor is
-     * used internally to generate the set of "small primes" whose multiples
-     * are excluded from sieves generated by the main (package private)
-     * constructor, BitSieve(BigInteger base, int searchLen).  The length
-     * of the sieve generated by this constructor was chosen for performance;
-     * it controls a tradeoff between how much time is spent constructing
-     * other sieves, and how much time is wasted testing composite candidates
-     * for primality.  The length was chosen experimentally to yield good
-     * performance.
-     */
-    private BitSieve() {
-        length = 150 * 64;
-        bits = new long[(unitIndex(length - 1) + 1)];
-
-        // Mark 1 as composite
-        set(0);
-        int nextIndex = 1;
-        int nextPrime = 3;
-
-        // Find primes and remove their multiples from sieve
-        do {
-            sieveSingle(length, nextIndex + nextPrime, nextPrime);
-            nextIndex = sieveSearch(length, nextIndex + 1);
-            nextPrime = 2*nextIndex + 1;
-        } while((nextIndex > 0) && (nextPrime < length));
-    }
-
-    /**
-     * Construct a bit sieve of searchLen bits used for finding prime number
-     * candidates. The new sieve begins at the specified base, which must
-     * be even.
-     */
-    BitSieve(BigInteger base, int searchLen) {
-        /*
-         * Candidates are indicated by clear bits in the sieve. As a candidates
-         * nonprimality is calculated, a bit is set in the sieve to eliminate
-         * it. To reduce storage space and increase efficiency, no even numbers
-         * are represented in the sieve (each bit in the sieve represents an
-         * odd number).
-         */
-        bits = new long[(unitIndex(searchLen-1) + 1)];
-        length = searchLen;
-        int start = 0;
-
-        int step = smallSieve.sieveSearch(smallSieve.length, start);
-        int convertedStep = (step *2) + 1;
-
-        // Construct the large sieve at an even offset specified by base
-        MutableBigInteger b = new MutableBigInteger(base);
-        MutableBigInteger q = new MutableBigInteger();
-        do {
-            // Calculate base mod convertedStep
-            start = b.divideOneWord(convertedStep, q);
-
-            // Take each multiple of step out of sieve
-            start = convertedStep - start;
-            if (start%2 == 0)
-                start += convertedStep;
-            sieveSingle(searchLen, (start-1)/2, convertedStep);
-
-            // Find next prime from small sieve
-            step = smallSieve.sieveSearch(smallSieve.length, step+1);
-            convertedStep = (step *2) + 1;
-        } while (step > 0);
-    }
-
-    /**
-     * Given a bit index return unit index containing it.
-     */
-    private static int unitIndex(int bitIndex) {
-        return bitIndex >>> 6;
-    }
-
-    /**
-     * Return a unit that masks the specified bit in its unit.
-     */
-    private static long bit(int bitIndex) {
-        return 1L << (bitIndex & ((1<<6) - 1));
-    }
-
-    /**
-     * Get the value of the bit at the specified index.
-     */
-    private boolean get(int bitIndex) {
-        int unitIndex = unitIndex(bitIndex);
-        return ((bits[unitIndex] & bit(bitIndex)) != 0);
-    }
-
-    /**
-     * Set the bit at the specified index.
-     */
-    private void set(int bitIndex) {
-        int unitIndex = unitIndex(bitIndex);
-        bits[unitIndex] |= bit(bitIndex);
-    }
-
-    /**
-     * This method returns the index of the first clear bit in the search
-     * array that occurs at or after start. It will not search past the
-     * specified limit. It returns -1 if there is no such clear bit.
-     */
-    private int sieveSearch(int limit, int start) {
-        if (start >= limit)
-            return -1;
-
-        int index = start;
-        do {
-            if (!get(index))
-                return index;
-            index++;
-        } while(index < limit-1);
-        return -1;
-    }
-
-    /**
-     * Sieve a single set of multiples out of the sieve. Begin to remove
-     * multiples of the specified step starting at the specified start index,
-     * up to the specified limit.
-     */
-    private void sieveSingle(int limit, int start, int step) {
-        while(start < limit) {
-            set(start);
-            start += step;
-        }
-    }
-
-    /**
-     * Test probable primes in the sieve and return successful candidates.
-     */
-    BigInteger retrieve(BigInteger initValue, int certainty, java.util.Random random) {
-        // Examine the sieve one long at a time to find possible primes
-        int offset = 1;
-        for (int i=0; i<bits.length; i++) {
-            long nextLong = ~bits[i];
-            for (int j=0; j<64; j++) {
-                if ((nextLong & 1) == 1) {
-                    BigInteger candidate = initValue.add(
-                                           BigInteger.valueOf(offset));
-                    if (candidate.primeToCertainty(certainty, random))
-                        return candidate;
-                }
-                nextLong >>>= 1;
-                offset+=2;
-            }
-        }
-        return null;
-    }
-}
diff --git a/ojluni/src/main/java/java/math/MathContext.java b/ojluni/src/main/java/java/math/MathContext.java
deleted file mode 100755
index f9947d3..0000000
--- a/ojluni/src/main/java/java/math/MathContext.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Portions Copyright IBM Corporation, 1997, 2001. All Rights Reserved.
- */
-
-package java.math;
-import java.io.*;
-
-/**
- * Immutable objects which encapsulate the context settings which
- * describe certain rules for numerical operators, such as those
- * implemented by the {@link BigDecimal} class.
- *
- * <p>The base-independent settings are:
- * <ol>
- * <li>{@code precision}:
- * the number of digits to be used for an operation; results are
- * rounded to this precision
- *
- * <li>{@code roundingMode}:
- * a {@link RoundingMode} object which specifies the algorithm to be
- * used for rounding.
- * </ol>
- *
- * @see     BigDecimal
- * @see     RoundingMode
- * @author  Mike Cowlishaw
- * @author  Joseph D. Darcy
- * @since 1.5
- */
-
-public final class MathContext implements Serializable {
-
-    /* ----- Constants ----- */
-
-    // defaults for constructors
-    private static final int DEFAULT_DIGITS = 9;
-    private static final RoundingMode DEFAULT_ROUNDINGMODE = RoundingMode.HALF_UP;
-    // Smallest values for digits (Maximum is Integer.MAX_VALUE)
-    private static final int MIN_DIGITS = 0;
-
-    // Serialization version
-    private static final long serialVersionUID = 5579720004786848255L;
-
-    /* ----- Public Properties ----- */
-    /**
-     *  A {@code MathContext} object whose settings have the values
-     *  required for unlimited precision arithmetic.
-     *  The values of the settings are:
-     *  <code>
-     *  precision=0 roundingMode=HALF_UP
-     *  </code>
-     */
-    public static final MathContext UNLIMITED =
-        new MathContext(0, RoundingMode.HALF_UP);
-
-    /**
-     *  A {@code MathContext} object with a precision setting
-     *  matching the IEEE 754R Decimal32 format, 7 digits, and a
-     *  rounding mode of {@link RoundingMode#HALF_EVEN HALF_EVEN}, the
-     *  IEEE 754R default.
-     */
-    public static final MathContext DECIMAL32 =
-        new MathContext(7, RoundingMode.HALF_EVEN);
-
-    /**
-     *  A {@code MathContext} object with a precision setting
-     *  matching the IEEE 754R Decimal64 format, 16 digits, and a
-     *  rounding mode of {@link RoundingMode#HALF_EVEN HALF_EVEN}, the
-     *  IEEE 754R default.
-     */
-    public static final MathContext DECIMAL64 =
-        new MathContext(16, RoundingMode.HALF_EVEN);
-
-    /**
-     *  A {@code MathContext} object with a precision setting
-     *  matching the IEEE 754R Decimal128 format, 34 digits, and a
-     *  rounding mode of {@link RoundingMode#HALF_EVEN HALF_EVEN}, the
-     *  IEEE 754R default.
-     */
-    public static final MathContext DECIMAL128 =
-        new MathContext(34, RoundingMode.HALF_EVEN);
-
-    /* ----- Shared Properties ----- */
-    /**
-     * The number of digits to be used for an operation.  A value of 0
-     * indicates that unlimited precision (as many digits as are
-     * required) will be used.  Note that leading zeros (in the
-     * coefficient of a number) are never significant.
-     *
-     * <p>{@code precision} will always be non-negative.
-     *
-     * @serial
-     */
-    final int precision;
-
-    /**
-     * The rounding algorithm to be used for an operation.
-     *
-     * @see RoundingMode
-     * @serial
-     */
-    final RoundingMode roundingMode;
-
-    /* ----- Constructors ----- */
-
-    /**
-     * Constructs a new {@code MathContext} with the specified
-     * precision and the {@link RoundingMode#HALF_UP HALF_UP} rounding
-     * mode.
-     *
-     * @param setPrecision The non-negative {@code int} precision setting.
-     * @throws IllegalArgumentException if the {@code setPrecision} parameter is less
-     *         than zero.
-     */
-    public MathContext(int setPrecision) {
-        this(setPrecision, DEFAULT_ROUNDINGMODE);
-        return;
-    }
-
-    /**
-     * Constructs a new {@code MathContext} with a specified
-     * precision and rounding mode.
-     *
-     * @param setPrecision The non-negative {@code int} precision setting.
-     * @param setRoundingMode The rounding mode to use.
-     * @throws IllegalArgumentException if the {@code setPrecision} parameter is less
-     *         than zero.
-     * @throws NullPointerException if the rounding mode argument is {@code null}
-     */
-    public MathContext(int setPrecision,
-                       RoundingMode setRoundingMode) {
-        if (setPrecision < MIN_DIGITS)
-            throw new IllegalArgumentException("Digits < 0");
-        if (setRoundingMode == null)
-            throw new NullPointerException("null RoundingMode");
-
-        precision = setPrecision;
-        roundingMode = setRoundingMode;
-        return;
-    }
-
-    /**
-     * Constructs a new {@code MathContext} from a string.
-     *
-     * The string must be in the same format as that produced by the
-     * {@link #toString} method.
-     *
-     * <p>An {@code IllegalArgumentException} is thrown if the precision
-     * section of the string is out of range ({@code < 0}) or the string is
-     * not in the format created by the {@link #toString} method.
-     *
-     * @param val The string to be parsed
-     * @throws IllegalArgumentException if the precision section is out of range
-     * or of incorrect format
-     * @throws NullPointerException if the argument is {@code null}
-     */
-    public MathContext(String val) {
-        boolean bad = false;
-        int setPrecision;
-        if (val == null)
-            throw new NullPointerException("null String");
-        try { // any error here is a string format problem
-            if (!val.startsWith("precision=")) throw new RuntimeException();
-            int fence = val.indexOf(' ');    // could be -1
-            int off = 10;                     // where value starts
-            setPrecision = Integer.parseInt(val.substring(10, fence));
-
-            if (!val.startsWith("roundingMode=", fence+1))
-                throw new RuntimeException();
-            off = fence + 1 + 13;
-            String str = val.substring(off, val.length());
-            roundingMode = RoundingMode.valueOf(str);
-        } catch (RuntimeException re) {
-            throw new IllegalArgumentException("bad string format");
-        }
-
-        if (setPrecision < MIN_DIGITS)
-            throw new IllegalArgumentException("Digits < 0");
-        // the other parameters cannot be invalid if we got here
-        precision = setPrecision;
-    }
-
-    /**
-     * Returns the {@code precision} setting.
-     * This value is always non-negative.
-     *
-     * @return an {@code int} which is the value of the {@code precision}
-     *         setting
-     */
-    public int getPrecision() {
-        return precision;
-    }
-
-    /**
-     * Returns the roundingMode setting.
-     * This will be one of
-     * {@link  RoundingMode#CEILING},
-     * {@link  RoundingMode#DOWN},
-     * {@link  RoundingMode#FLOOR},
-     * {@link  RoundingMode#HALF_DOWN},
-     * {@link  RoundingMode#HALF_EVEN},
-     * {@link  RoundingMode#HALF_UP},
-     * {@link  RoundingMode#UNNECESSARY}, or
-     * {@link  RoundingMode#UP}.
-     *
-     * @return a {@code RoundingMode} object which is the value of the
-     *         {@code roundingMode} setting
-     */
-
-    public RoundingMode getRoundingMode() {
-        return roundingMode;
-    }
-
-    /**
-     * Compares this {@code MathContext} with the specified
-     * {@code Object} for equality.
-     *
-     * @param  x {@code Object} to which this {@code MathContext} is to
-     *         be compared.
-     * @return {@code true} if and only if the specified {@code Object} is
-     *         a {@code MathContext} object which has exactly the same
-     *         settings as this object
-     */
-    public boolean equals(Object x){
-        MathContext mc;
-        if (!(x instanceof MathContext))
-            return false;
-        mc = (MathContext) x;
-        return mc.precision == this.precision
-            && mc.roundingMode == this.roundingMode; // no need for .equals()
-    }
-
-    /**
-     * Returns the hash code for this {@code MathContext}.
-     *
-     * @return hash code for this {@code MathContext}
-     */
-    public int hashCode() {
-        return this.precision + roundingMode.hashCode() * 59;
-    }
-
-    /**
-     * Returns the string representation of this {@code MathContext}.
-     * The {@code String} returned represents the settings of the
-     * {@code MathContext} object as two space-delimited words
-     * (separated by a single space character, <tt>'&#92;u0020'</tt>,
-     * and with no leading or trailing white space), as follows:
-     * <ol>
-     * <li>
-     * The string {@code "precision="}, immediately followed
-     * by the value of the precision setting as a numeric string as if
-     * generated by the {@link Integer#toString(int) Integer.toString}
-     * method.
-     *
-     * <li>
-     * The string {@code "roundingMode="}, immediately
-     * followed by the value of the {@code roundingMode} setting as a
-     * word.  This word will be the same as the name of the
-     * corresponding public constant in the {@link RoundingMode}
-     * enum.
-     * </ol>
-     * <p>
-     * For example:
-     * <pre>
-     * precision=9 roundingMode=HALF_UP
-     * </pre>
-     *
-     * Additional words may be appended to the result of
-     * {@code toString} in the future if more properties are added to
-     * this class.
-     *
-     * @return a {@code String} representing the context settings
-     */
-    public java.lang.String toString() {
-        return "precision=" +           precision + " " +
-               "roundingMode=" +        roundingMode.toString();
-    }
-
-    // Private methods
-
-    /**
-     * Reconstitute the {@code MathContext} instance from a stream (that is,
-     * deserialize it).
-     *
-     * @param s the stream being read.
-     */
-    private void readObject(java.io.ObjectInputStream s)
-        throws java.io.IOException, ClassNotFoundException {
-        s.defaultReadObject();     // read in all fields
-        // validate possibly bad fields
-        if (precision < MIN_DIGITS) {
-            String message = "MathContext: invalid digits in stream";
-            throw new java.io.StreamCorruptedException(message);
-        }
-        if (roundingMode == null) {
-            String message = "MathContext: null roundingMode in stream";
-            throw new java.io.StreamCorruptedException(message);
-        }
-    }
-
-}
diff --git a/ojluni/src/main/java/java/math/MutableBigInteger.java b/ojluni/src/main/java/java/math/MutableBigInteger.java
deleted file mode 100755
index 0cb1544..0000000
--- a/ojluni/src/main/java/java/math/MutableBigInteger.java
+++ /dev/null
@@ -1,1477 +0,0 @@
-/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.math;
-
-/**
- * A class used to represent multiprecision integers that makes efficient
- * use of allocated space by allowing a number to occupy only part of
- * an array so that the arrays do not have to be reallocated as often.
- * When performing an operation with many iterations the array used to
- * hold a number is only reallocated when necessary and does not have to
- * be the same size as the number it represents. A mutable number allows
- * calculations to occur on the same number without having to create
- * a new number for every step of the calculation as occurs with
- * BigIntegers.
- *
- * @see     BigInteger
- * @author  Michael McCloskey
- * @since   1.3
- */
-
-import java.util.Arrays;
-
-import static java.math.BigInteger.LONG_MASK;
-import static java.math.BigDecimal.INFLATED;
-
-class MutableBigInteger {
-    /**
-     * Holds the magnitude of this MutableBigInteger in big endian order.
-     * The magnitude may start at an offset into the value array, and it may
-     * end before the length of the value array.
-     */
-    int[] value;
-
-    /**
-     * The number of ints of the value array that are currently used
-     * to hold the magnitude of this MutableBigInteger. The magnitude starts
-     * at an offset and offset + intLen may be less than value.length.
-     */
-    int intLen;
-
-    /**
-     * The offset into the value array where the magnitude of this
-     * MutableBigInteger begins.
-     */
-    int offset = 0;
-
-    // Constants
-    /**
-     * MutableBigInteger with one element value array with the value 1. Used by
-     * BigDecimal divideAndRound to increment the quotient. Use this constant
-     * only when the method is not going to modify this object.
-     */
-    static final MutableBigInteger ONE = new MutableBigInteger(1);
-
-    // Constructors
-
-    /**
-     * The default constructor. An empty MutableBigInteger is created with
-     * a one word capacity.
-     */
-    MutableBigInteger() {
-        value = new int[1];
-        intLen = 0;
-    }
-
-    /**
-     * Construct a new MutableBigInteger with a magnitude specified by
-     * the int val.
-     */
-    MutableBigInteger(int val) {
-        value = new int[1];
-        intLen = 1;
-        value[0] = val;
-    }
-
-    /**
-     * Construct a new MutableBigInteger with the specified value array
-     * up to the length of the array supplied.
-     */
-    MutableBigInteger(int[] val) {
-        value = val;
-        intLen = val.length;
-    }
-
-    /**
-     * Construct a new MutableBigInteger with a magnitude equal to the
-     * specified BigInteger.
-     */
-    MutableBigInteger(BigInteger b) {
-        intLen = b.mag.length;
-        value = Arrays.copyOf(b.mag, intLen);
-    }
-
-    /**
-     * Construct a new MutableBigInteger with a magnitude equal to the
-     * specified MutableBigInteger.
-     */
-    MutableBigInteger(MutableBigInteger val) {
-        intLen = val.intLen;
-        value = Arrays.copyOfRange(val.value, val.offset, val.offset + intLen);
-    }
-
-    /**
-     * Internal helper method to return the magnitude array. The caller is not
-     * supposed to modify the returned array.
-     */
-    private int[] getMagnitudeArray() {
-        if (offset > 0 || value.length != intLen)
-            return Arrays.copyOfRange(value, offset, offset + intLen);
-        return value;
-    }
-
-    /**
-     * Convert this MutableBigInteger to a long value. The caller has to make
-     * sure this MutableBigInteger can be fit into long.
-     */
-    private long toLong() {
-        assert (intLen <= 2) : "this MutableBigInteger exceeds the range of long";
-        if (intLen == 0)
-            return 0;
-        long d = value[offset] & LONG_MASK;
-        return (intLen == 2) ? d << 32 | (value[offset + 1] & LONG_MASK) : d;
-    }
-
-    /**
-     * Convert this MutableBigInteger to a BigInteger object.
-     */
-    BigInteger toBigInteger(int sign) {
-        if (intLen == 0 || sign == 0)
-            return BigInteger.ZERO;
-        return new BigInteger(getMagnitudeArray(), sign);
-    }
-
-    /**
-     * Convert this MutableBigInteger to BigDecimal object with the specified sign
-     * and scale.
-     */
-    BigDecimal toBigDecimal(int sign, int scale) {
-        if (intLen == 0 || sign == 0)
-            return BigDecimal.valueOf(0, scale);
-        int[] mag = getMagnitudeArray();
-        int len = mag.length;
-        int d = mag[0];
-        // If this MutableBigInteger can't be fit into long, we need to
-        // make a BigInteger object for the resultant BigDecimal object.
-        if (len > 2 || (d < 0 && len == 2))
-            return new BigDecimal(new BigInteger(mag, sign), INFLATED, scale, 0);
-        long v = (len == 2) ?
-            ((mag[1] & LONG_MASK) | (d & LONG_MASK) << 32) :
-            d & LONG_MASK;
-        return new BigDecimal(null, sign == -1 ? -v : v, scale, 0);
-    }
-
-    /**
-     * Clear out a MutableBigInteger for reuse.
-     */
-    void clear() {
-        offset = intLen = 0;
-        for (int index=0, n=value.length; index < n; index++)
-            value[index] = 0;
-    }
-
-    /**
-     * Set a MutableBigInteger to zero, removing its offset.
-     */
-    void reset() {
-        offset = intLen = 0;
-    }
-
-    /**
-     * Compare the magnitude of two MutableBigIntegers. Returns -1, 0 or 1
-     * as this MutableBigInteger is numerically less than, equal to, or
-     * greater than <tt>b</tt>.
-     */
-    final int compare(MutableBigInteger b) {
-        int blen = b.intLen;
-        if (intLen < blen)
-            return -1;
-        if (intLen > blen)
-           return 1;
-
-        // Add Integer.MIN_VALUE to make the comparison act as unsigned integer
-        // comparison.
-        int[] bval = b.value;
-        for (int i = offset, j = b.offset; i < intLen + offset; i++, j++) {
-            int b1 = value[i] + 0x80000000;
-            int b2 = bval[j]  + 0x80000000;
-            if (b1 < b2)
-                return -1;
-            if (b1 > b2)
-                return 1;
-        }
-        return 0;
-    }
-
-    /**
-     * Compare this against half of a MutableBigInteger object (Needed for
-     * remainder tests).
-     * Assumes no leading unnecessary zeros, which holds for results
-     * from divide().
-     */
-    final int compareHalf(MutableBigInteger b) {
-        int blen = b.intLen;
-        int len = intLen;
-        if (len <= 0)
-            return blen <=0 ? 0 : -1;
-        if (len > blen)
-            return 1;
-        if (len < blen - 1)
-            return -1;
-        int[] bval = b.value;
-        int bstart = 0;
-        int carry = 0;
-        // Only 2 cases left:len == blen or len == blen - 1
-        if (len != blen) { // len == blen - 1
-            if (bval[bstart] == 1) {
-                ++bstart;
-                carry = 0x80000000;
-            } else
-                return -1;
-        }
-        // compare values with right-shifted values of b,
-        // carrying shifted-out bits across words
-        int[] val = value;
-        for (int i = offset, j = bstart; i < len + offset;) {
-            int bv = bval[j++];
-            long hb = ((bv >>> 1) + carry) & LONG_MASK;
-            long v = val[i++] & LONG_MASK;
-            if (v != hb)
-                return v < hb ? -1 : 1;
-            carry = (bv & 1) << 31; // carray will be either 0x80000000 or 0
-        }
-        return carry == 0? 0 : -1;
-    }
-
-    /**
-     * Return the index of the lowest set bit in this MutableBigInteger. If the
-     * magnitude of this MutableBigInteger is zero, -1 is returned.
-     */
-    private final int getLowestSetBit() {
-        if (intLen == 0)
-            return -1;
-        int j, b;
-        for (j=intLen-1; (j>0) && (value[j+offset]==0); j--)
-            ;
-        b = value[j+offset];
-        if (b==0)
-            return -1;
-        return ((intLen-1-j)<<5) + Integer.numberOfTrailingZeros(b);
-    }
-
-    /**
-     * Return the int in use in this MutableBigInteger at the specified
-     * index. This method is not used because it is not inlined on all
-     * platforms.
-     */
-    private final int getInt(int index) {
-        return value[offset+index];
-    }
-
-    /**
-     * Return a long which is equal to the unsigned value of the int in
-     * use in this MutableBigInteger at the specified index. This method is
-     * not used because it is not inlined on all platforms.
-     */
-    private final long getLong(int index) {
-        return value[offset+index] & LONG_MASK;
-    }
-
-    /**
-     * Ensure that the MutableBigInteger is in normal form, specifically
-     * making sure that there are no leading zeros, and that if the
-     * magnitude is zero, then intLen is zero.
-     */
-    final void normalize() {
-        if (intLen == 0) {
-            offset = 0;
-            return;
-        }
-
-        int index = offset;
-        if (value[index] != 0)
-            return;
-
-        int indexBound = index+intLen;
-        do {
-            index++;
-        } while(index < indexBound && value[index]==0);
-
-        int numZeros = index - offset;
-        intLen -= numZeros;
-        offset = (intLen==0 ?  0 : offset+numZeros);
-    }
-
-    /**
-     * If this MutableBigInteger cannot hold len words, increase the size
-     * of the value array to len words.
-     */
-    private final void ensureCapacity(int len) {
-        if (value.length < len) {
-            value = new int[len];
-            offset = 0;
-            intLen = len;
-        }
-    }
-
-    /**
-     * Convert this MutableBigInteger into an int array with no leading
-     * zeros, of a length that is equal to this MutableBigInteger's intLen.
-     */
-    int[] toIntArray() {
-        int[] result = new int[intLen];
-        for(int i=0; i<intLen; i++)
-            result[i] = value[offset+i];
-        return result;
-    }
-
-    /**
-     * Sets the int at index+offset in this MutableBigInteger to val.
-     * This does not get inlined on all platforms so it is not used
-     * as often as originally intended.
-     */
-    void setInt(int index, int val) {
-        value[offset + index] = val;
-    }
-
-    /**
-     * Sets this MutableBigInteger's value array to the specified array.
-     * The intLen is set to the specified length.
-     */
-    void setValue(int[] val, int length) {
-        value = val;
-        intLen = length;
-        offset = 0;
-    }
-
-    /**
-     * Sets this MutableBigInteger's value array to a copy of the specified
-     * array. The intLen is set to the length of the new array.
-     */
-    void copyValue(MutableBigInteger src) {
-        int len = src.intLen;
-        if (value.length < len)
-            value = new int[len];
-        System.arraycopy(src.value, src.offset, value, 0, len);
-        intLen = len;
-        offset = 0;
-    }
-
-    /**
-     * Sets this MutableBigInteger's value array to a copy of the specified
-     * array. The intLen is set to the length of the specified array.
-     */
-    void copyValue(int[] val) {
-        int len = val.length;
-        if (value.length < len)
-            value = new int[len];
-        System.arraycopy(val, 0, value, 0, len);
-        intLen = len;
-        offset = 0;
-    }
-
-    /**
-     * Returns true iff this MutableBigInteger has a value of one.
-     */
-    boolean isOne() {
-        return (intLen == 1) && (value[offset] == 1);
-    }
-
-    /**
-     * Returns true iff this MutableBigInteger has a value of zero.
-     */
-    boolean isZero() {
-        return (intLen == 0);
-    }
-
-    /**
-     * Returns true iff this MutableBigInteger is even.
-     */
-    boolean isEven() {
-        return (intLen == 0) || ((value[offset + intLen - 1] & 1) == 0);
-    }
-
-    /**
-     * Returns true iff this MutableBigInteger is odd.
-     */
-    boolean isOdd() {
-        return isZero() ? false : ((value[offset + intLen - 1] & 1) == 1);
-    }
-
-    /**
-     * Returns true iff this MutableBigInteger is in normal form. A
-     * MutableBigInteger is in normal form if it has no leading zeros
-     * after the offset, and intLen + offset <= value.length.
-     */
-    boolean isNormal() {
-        if (intLen + offset > value.length)
-            return false;
-        if (intLen ==0)
-            return true;
-        return (value[offset] != 0);
-    }
-
-    /**
-     * Returns a String representation of this MutableBigInteger in radix 10.
-     */
-    public String toString() {
-        BigInteger b = toBigInteger(1);
-        return b.toString();
-    }
-
-    /**
-     * Right shift this MutableBigInteger n bits. The MutableBigInteger is left
-     * in normal form.
-     */
-    void rightShift(int n) {
-        if (intLen == 0)
-            return;
-        int nInts = n >>> 5;
-        int nBits = n & 0x1F;
-        this.intLen -= nInts;
-        if (nBits == 0)
-            return;
-        int bitsInHighWord = BigInteger.bitLengthForInt(value[offset]);
-        if (nBits >= bitsInHighWord) {
-            this.primitiveLeftShift(32 - nBits);
-            this.intLen--;
-        } else {
-            primitiveRightShift(nBits);
-        }
-    }
-
-    /**
-     * Left shift this MutableBigInteger n bits.
-     */
-    void leftShift(int n) {
-        /*
-         * If there is enough storage space in this MutableBigInteger already
-         * the available space will be used. Space to the right of the used
-         * ints in the value array is faster to utilize, so the extra space
-         * will be taken from the right if possible.
-         */
-        if (intLen == 0)
-           return;
-        int nInts = n >>> 5;
-        int nBits = n&0x1F;
-        int bitsInHighWord = BigInteger.bitLengthForInt(value[offset]);
-
-        // If shift can be done without moving words, do so
-        if (n <= (32-bitsInHighWord)) {
-            primitiveLeftShift(nBits);
-            return;
-        }
-
-        int newLen = intLen + nInts +1;
-        if (nBits <= (32-bitsInHighWord))
-            newLen--;
-        if (value.length < newLen) {
-            // The array must grow
-            int[] result = new int[newLen];
-            for (int i=0; i<intLen; i++)
-                result[i] = value[offset+i];
-            setValue(result, newLen);
-        } else if (value.length - offset >= newLen) {
-            // Use space on right
-            for(int i=0; i<newLen - intLen; i++)
-                value[offset+intLen+i] = 0;
-        } else {
-            // Must use space on left
-            for (int i=0; i<intLen; i++)
-                value[i] = value[offset+i];
-            for (int i=intLen; i<newLen; i++)
-                value[i] = 0;
-            offset = 0;
-        }
-        intLen = newLen;
-        if (nBits == 0)
-            return;
-        if (nBits <= (32-bitsInHighWord))
-            primitiveLeftShift(nBits);
-        else
-            primitiveRightShift(32 -nBits);
-    }
-
-    /**
-     * A primitive used for division. This method adds in one multiple of the
-     * divisor a back to the dividend result at a specified offset. It is used
-     * when qhat was estimated too large, and must be adjusted.
-     */
-    private int divadd(int[] a, int[] result, int offset) {
-        long carry = 0;
-
-        for (int j=a.length-1; j >= 0; j--) {
-            long sum = (a[j] & LONG_MASK) +
-                       (result[j+offset] & LONG_MASK) + carry;
-            result[j+offset] = (int)sum;
-            carry = sum >>> 32;
-        }
-        return (int)carry;
-    }
-
-    /**
-     * This method is used for division. It multiplies an n word input a by one
-     * word input x, and subtracts the n word product from q. This is needed
-     * when subtracting qhat*divisor from dividend.
-     */
-    private int mulsub(int[] q, int[] a, int x, int len, int offset) {
-        long xLong = x & LONG_MASK;
-        long carry = 0;
-        offset += len;
-
-        for (int j=len-1; j >= 0; j--) {
-            long product = (a[j] & LONG_MASK) * xLong + carry;
-            long difference = q[offset] - product;
-            q[offset--] = (int)difference;
-            carry = (product >>> 32)
-                     + (((difference & LONG_MASK) >
-                         (((~(int)product) & LONG_MASK))) ? 1:0);
-        }
-        return (int)carry;
-    }
-
-    /**
-     * Right shift this MutableBigInteger n bits, where n is
-     * less than 32.
-     * Assumes that intLen > 0, n > 0 for speed
-     */
-    private final void primitiveRightShift(int n) {
-        int[] val = value;
-        int n2 = 32 - n;
-        for (int i=offset+intLen-1, c=val[i]; i>offset; i--) {
-            int b = c;
-            c = val[i-1];
-            val[i] = (c << n2) | (b >>> n);
-        }
-        val[offset] >>>= n;
-    }
-
-    /**
-     * Left shift this MutableBigInteger n bits, where n is
-     * less than 32.
-     * Assumes that intLen > 0, n > 0 for speed
-     */
-    private final void primitiveLeftShift(int n) {
-        int[] val = value;
-        int n2 = 32 - n;
-        for (int i=offset, c=val[i], m=i+intLen-1; i<m; i++) {
-            int b = c;
-            c = val[i+1];
-            val[i] = (b << n) | (c >>> n2);
-        }
-        val[offset+intLen-1] <<= n;
-    }
-
-    /**
-     * Adds the contents of two MutableBigInteger objects.The result
-     * is placed within this MutableBigInteger.
-     * The contents of the addend are not changed.
-     */
-    void add(MutableBigInteger addend) {
-        int x = intLen;
-        int y = addend.intLen;
-        int resultLen = (intLen > addend.intLen ? intLen : addend.intLen);
-        int[] result = (value.length < resultLen ? new int[resultLen] : value);
-
-        int rstart = result.length-1;
-        long sum;
-        long carry = 0;
-
-        // Add common parts of both numbers
-        while(x>0 && y>0) {
-            x--; y--;
-            sum = (value[x+offset] & LONG_MASK) +
-                (addend.value[y+addend.offset] & LONG_MASK) + carry;
-            result[rstart--] = (int)sum;
-            carry = sum >>> 32;
-        }
-
-        // Add remainder of the longer number
-        while(x>0) {
-            x--;
-            if (carry == 0 && result == value && rstart == (x + offset))
-                return;
-            sum = (value[x+offset] & LONG_MASK) + carry;
-            result[rstart--] = (int)sum;
-            carry = sum >>> 32;
-        }
-        while(y>0) {
-            y--;
-            sum = (addend.value[y+addend.offset] & LONG_MASK) + carry;
-            result[rstart--] = (int)sum;
-            carry = sum >>> 32;
-        }
-
-        if (carry > 0) { // Result must grow in length
-            resultLen++;
-            if (result.length < resultLen) {
-                int temp[] = new int[resultLen];
-                // Result one word longer from carry-out; copy low-order
-                // bits into new result.
-                System.arraycopy(result, 0, temp, 1, result.length);
-                temp[0] = 1;
-                result = temp;
-            } else {
-                result[rstart--] = 1;
-            }
-        }
-
-        value = result;
-        intLen = resultLen;
-        offset = result.length - resultLen;
-    }
-
-
-    /**
-     * Subtracts the smaller of this and b from the larger and places the
-     * result into this MutableBigInteger.
-     */
-    int subtract(MutableBigInteger b) {
-        MutableBigInteger a = this;
-
-        int[] result = value;
-        int sign = a.compare(b);
-
-        if (sign == 0) {
-            reset();
-            return 0;
-        }
-        if (sign < 0) {
-            MutableBigInteger tmp = a;
-            a = b;
-            b = tmp;
-        }
-
-        int resultLen = a.intLen;
-        if (result.length < resultLen)
-            result = new int[resultLen];
-
-        long diff = 0;
-        int x = a.intLen;
-        int y = b.intLen;
-        int rstart = result.length - 1;
-
-        // Subtract common parts of both numbers
-        while (y>0) {
-            x--; y--;
-
-            diff = (a.value[x+a.offset] & LONG_MASK) -
-                   (b.value[y+b.offset] & LONG_MASK) - ((int)-(diff>>32));
-            result[rstart--] = (int)diff;
-        }
-        // Subtract remainder of longer number
-        while (x>0) {
-            x--;
-            diff = (a.value[x+a.offset] & LONG_MASK) - ((int)-(diff>>32));
-            result[rstart--] = (int)diff;
-        }
-
-        value = result;
-        intLen = resultLen;
-        offset = value.length - resultLen;
-        normalize();
-        return sign;
-    }
-
-    /**
-     * Subtracts the smaller of a and b from the larger and places the result
-     * into the larger. Returns 1 if the answer is in a, -1 if in b, 0 if no
-     * operation was performed.
-     */
-    private int difference(MutableBigInteger b) {
-        MutableBigInteger a = this;
-        int sign = a.compare(b);
-        if (sign ==0)
-            return 0;
-        if (sign < 0) {
-            MutableBigInteger tmp = a;
-            a = b;
-            b = tmp;
-        }
-
-        long diff = 0;
-        int x = a.intLen;
-        int y = b.intLen;
-
-        // Subtract common parts of both numbers
-        while (y>0) {
-            x--; y--;
-            diff = (a.value[a.offset+ x] & LONG_MASK) -
-                (b.value[b.offset+ y] & LONG_MASK) - ((int)-(diff>>32));
-            a.value[a.offset+x] = (int)diff;
-        }
-        // Subtract remainder of longer number
-        while (x>0) {
-            x--;
-            diff = (a.value[a.offset+ x] & LONG_MASK) - ((int)-(diff>>32));
-            a.value[a.offset+x] = (int)diff;
-        }
-
-        a.normalize();
-        return sign;
-    }
-
-    /**
-     * Multiply the contents of two MutableBigInteger objects. The result is
-     * placed into MutableBigInteger z. The contents of y are not changed.
-     */
-    void multiply(MutableBigInteger y, MutableBigInteger z) {
-        int xLen = intLen;
-        int yLen = y.intLen;
-        int newLen = xLen + yLen;
-
-        // Put z into an appropriate state to receive product
-        if (z.value.length < newLen)
-            z.value = new int[newLen];
-        z.offset = 0;
-        z.intLen = newLen;
-
-        // The first iteration is hoisted out of the loop to avoid extra add
-        long carry = 0;
-        for (int j=yLen-1, k=yLen+xLen-1; j >= 0; j--, k--) {
-                long product = (y.value[j+y.offset] & LONG_MASK) *
-                               (value[xLen-1+offset] & LONG_MASK) + carry;
-                z.value[k] = (int)product;
-                carry = product >>> 32;
-        }
-        z.value[xLen-1] = (int)carry;
-
-        // Perform the multiplication word by word
-        for (int i = xLen-2; i >= 0; i--) {
-            carry = 0;
-            for (int j=yLen-1, k=yLen+i; j >= 0; j--, k--) {
-                long product = (y.value[j+y.offset] & LONG_MASK) *
-                               (value[i+offset] & LONG_MASK) +
-                               (z.value[k] & LONG_MASK) + carry;
-                z.value[k] = (int)product;
-                carry = product >>> 32;
-            }
-            z.value[i] = (int)carry;
-        }
-
-        // Remove leading zeros from product
-        z.normalize();
-    }
-
-    /**
-     * Multiply the contents of this MutableBigInteger by the word y. The
-     * result is placed into z.
-     */
-    void mul(int y, MutableBigInteger z) {
-        if (y == 1) {
-            z.copyValue(this);
-            return;
-        }
-
-        if (y == 0) {
-            z.clear();
-            return;
-        }
-
-        // Perform the multiplication word by word
-        long ylong = y & LONG_MASK;
-        int[] zval = (z.value.length<intLen+1 ? new int[intLen + 1]
-                                              : z.value);
-        long carry = 0;
-        for (int i = intLen-1; i >= 0; i--) {
-            long product = ylong * (value[i+offset] & LONG_MASK) + carry;
-            zval[i+1] = (int)product;
-            carry = product >>> 32;
-        }
-
-        if (carry == 0) {
-            z.offset = 1;
-            z.intLen = intLen;
-        } else {
-            z.offset = 0;
-            z.intLen = intLen + 1;
-            zval[0] = (int)carry;
-        }
-        z.value = zval;
-    }
-
-     /**
-     * This method is used for division of an n word dividend by a one word
-     * divisor. The quotient is placed into quotient. The one word divisor is
-     * specified by divisor.
-     *
-     * @return the remainder of the division is returned.
-     *
-     */
-    int divideOneWord(int divisor, MutableBigInteger quotient) {
-        long divisorLong = divisor & LONG_MASK;
-
-        // Special case of one word dividend
-        if (intLen == 1) {
-            long dividendValue = value[offset] & LONG_MASK;
-            int q = (int) (dividendValue / divisorLong);
-            int r = (int) (dividendValue - q * divisorLong);
-            quotient.value[0] = q;
-            quotient.intLen = (q == 0) ? 0 : 1;
-            quotient.offset = 0;
-            return r;
-        }
-
-        if (quotient.value.length < intLen)
-            quotient.value = new int[intLen];
-        quotient.offset = 0;
-        quotient.intLen = intLen;
-
-        // Normalize the divisor
-        int shift = Integer.numberOfLeadingZeros(divisor);
-
-        int rem = value[offset];
-        long remLong = rem & LONG_MASK;
-        if (remLong < divisorLong) {
-            quotient.value[0] = 0;
-        } else {
-            quotient.value[0] = (int)(remLong / divisorLong);
-            rem = (int) (remLong - (quotient.value[0] * divisorLong));
-            remLong = rem & LONG_MASK;
-        }
-
-        int xlen = intLen;
-        int[] qWord = new int[2];
-        while (--xlen > 0) {
-            long dividendEstimate = (remLong<<32) |
-                (value[offset + intLen - xlen] & LONG_MASK);
-            if (dividendEstimate >= 0) {
-                qWord[0] = (int) (dividendEstimate / divisorLong);
-                qWord[1] = (int) (dividendEstimate - qWord[0] * divisorLong);
-            } else {
-                divWord(qWord, dividendEstimate, divisor);
-            }
-            quotient.value[intLen - xlen] = qWord[0];
-            rem = qWord[1];
-            remLong = rem & LONG_MASK;
-        }
-
-        quotient.normalize();
-        // Unnormalize
-        if (shift > 0)
-            return rem % divisor;
-        else
-            return rem;
-    }
-
-    /**
-     * Calculates the quotient of this div b and places the quotient in the
-     * provided MutableBigInteger objects and the remainder object is returned.
-     *
-     * Uses Algorithm D in Knuth section 4.3.1.
-     * Many optimizations to that algorithm have been adapted from the Colin
-     * Plumb C library.
-     * It special cases one word divisors for speed. The content of b is not
-     * changed.
-     *
-     */
-    MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient) {
-        if (b.intLen == 0)
-            throw new ArithmeticException("BigInteger divide by zero");
-
-        // Dividend is zero
-        if (intLen == 0) {
-            quotient.intLen = quotient.offset;
-            return new MutableBigInteger();
-        }
-
-        int cmp = compare(b);
-        // Dividend less than divisor
-        if (cmp < 0) {
-            quotient.intLen = quotient.offset = 0;
-            return new MutableBigInteger(this);
-        }
-        // Dividend equal to divisor
-        if (cmp == 0) {
-            quotient.value[0] = quotient.intLen = 1;
-            quotient.offset = 0;
-            return new MutableBigInteger();
-        }
-
-        quotient.clear();
-        // Special case one word divisor
-        if (b.intLen == 1) {
-            int r = divideOneWord(b.value[b.offset], quotient);
-            if (r == 0)
-                return new MutableBigInteger();
-            return new MutableBigInteger(r);
-        }
-
-        // Copy divisor value to protect divisor
-        int[] div = Arrays.copyOfRange(b.value, b.offset, b.offset + b.intLen);
-        return divideMagnitude(div, quotient);
-    }
-
-    /**
-     * Internally used  to calculate the quotient of this div v and places the
-     * quotient in the provided MutableBigInteger object and the remainder is
-     * returned.
-     *
-     * @return the remainder of the division will be returned.
-     */
-    long divide(long v, MutableBigInteger quotient) {
-        if (v == 0)
-            throw new ArithmeticException("BigInteger divide by zero");
-
-        // Dividend is zero
-        if (intLen == 0) {
-            quotient.intLen = quotient.offset = 0;
-            return 0;
-        }
-        if (v < 0)
-            v = -v;
-
-        int d = (int)(v >>> 32);
-        quotient.clear();
-        // Special case on word divisor
-        if (d == 0)
-            return divideOneWord((int)v, quotient) & LONG_MASK;
-        else {
-            int[] div = new int[]{ d, (int)(v & LONG_MASK) };
-            return divideMagnitude(div, quotient).toLong();
-        }
-    }
-
-    /**
-     * Divide this MutableBigInteger by the divisor represented by its magnitude
-     * array. The quotient will be placed into the provided quotient object &
-     * the remainder object is returned.
-     */
-    private MutableBigInteger divideMagnitude(int[] divisor,
-                                              MutableBigInteger quotient) {
-
-        // Remainder starts as dividend with space for a leading zero
-        MutableBigInteger rem = new MutableBigInteger(new int[intLen + 1]);
-        System.arraycopy(value, offset, rem.value, 1, intLen);
-        rem.intLen = intLen;
-        rem.offset = 1;
-
-        int nlen = rem.intLen;
-
-        // Set the quotient size
-        int dlen = divisor.length;
-        int limit = nlen - dlen + 1;
-        if (quotient.value.length < limit) {
-            quotient.value = new int[limit];
-            quotient.offset = 0;
-        }
-        quotient.intLen = limit;
-        int[] q = quotient.value;
-
-        // D1 normalize the divisor
-        int shift = Integer.numberOfLeadingZeros(divisor[0]);
-        if (shift > 0) {
-            // First shift will not grow array
-            BigInteger.primitiveLeftShift(divisor, dlen, shift);
-            // But this one might
-            rem.leftShift(shift);
-        }
-
-        // Must insert leading 0 in rem if its length did not change
-        if (rem.intLen == nlen) {
-            rem.offset = 0;
-            rem.value[0] = 0;
-            rem.intLen++;
-        }
-
-        int dh = divisor[0];
-        long dhLong = dh & LONG_MASK;
-        int dl = divisor[1];
-        int[] qWord = new int[2];
-
-        // D2 Initialize j
-        for(int j=0; j<limit; j++) {
-            // D3 Calculate qhat
-            // estimate qhat
-            int qhat = 0;
-            int qrem = 0;
-            boolean skipCorrection = false;
-            int nh = rem.value[j+rem.offset];
-            int nh2 = nh + 0x80000000;
-            int nm = rem.value[j+1+rem.offset];
-
-            if (nh == dh) {
-                qhat = ~0;
-                qrem = nh + nm;
-                skipCorrection = qrem + 0x80000000 < nh2;
-            } else {
-                long nChunk = (((long)nh) << 32) | (nm & LONG_MASK);
-                if (nChunk >= 0) {
-                    qhat = (int) (nChunk / dhLong);
-                    qrem = (int) (nChunk - (qhat * dhLong));
-                } else {
-                    divWord(qWord, nChunk, dh);
-                    qhat = qWord[0];
-                    qrem = qWord[1];
-                }
-            }
-
-            if (qhat == 0)
-                continue;
-
-            if (!skipCorrection) { // Correct qhat
-                long nl = rem.value[j+2+rem.offset] & LONG_MASK;
-                long rs = ((qrem & LONG_MASK) << 32) | nl;
-                long estProduct = (dl & LONG_MASK) * (qhat & LONG_MASK);
-
-                if (unsignedLongCompare(estProduct, rs)) {
-                    qhat--;
-                    qrem = (int)((qrem & LONG_MASK) + dhLong);
-                    if ((qrem & LONG_MASK) >=  dhLong) {
-                        estProduct -= (dl & LONG_MASK);
-                        rs = ((qrem & LONG_MASK) << 32) | nl;
-                        if (unsignedLongCompare(estProduct, rs))
-                            qhat--;
-                    }
-                }
-            }
-
-            // D4 Multiply and subtract
-            rem.value[j+rem.offset] = 0;
-            int borrow = mulsub(rem.value, divisor, qhat, dlen, j+rem.offset);
-
-            // D5 Test remainder
-            if (borrow + 0x80000000 > nh2) {
-                // D6 Add back
-                divadd(divisor, rem.value, j+1+rem.offset);
-                qhat--;
-            }
-
-            // Store the quotient digit
-            q[j] = qhat;
-        } // D7 loop on j
-
-        // D8 Unnormalize
-        if (shift > 0)
-            rem.rightShift(shift);
-
-        quotient.normalize();
-        rem.normalize();
-        return rem;
-    }
-
-    /**
-     * Compare two longs as if they were unsigned.
-     * Returns true iff one is bigger than two.
-     */
-    private boolean unsignedLongCompare(long one, long two) {
-        return (one+Long.MIN_VALUE) > (two+Long.MIN_VALUE);
-    }
-
-    /**
-     * This method divides a long quantity by an int to estimate
-     * qhat for two multi precision numbers. It is used when
-     * the signed value of n is less than zero.
-     */
-    private void divWord(int[] result, long n, int d) {
-        long dLong = d & LONG_MASK;
-
-        if (dLong == 1) {
-            result[0] = (int)n;
-            result[1] = 0;
-            return;
-        }
-
-        // Approximate the quotient and remainder
-        long q = (n >>> 1) / (dLong >>> 1);
-        long r = n - q*dLong;
-
-        // Correct the approximation
-        while (r < 0) {
-            r += dLong;
-            q--;
-        }
-        while (r >= dLong) {
-            r -= dLong;
-            q++;
-        }
-
-        // n - q*dlong == r && 0 <= r <dLong, hence we're done.
-        result[0] = (int)q;
-        result[1] = (int)r;
-    }
-
-    /**
-     * Calculate GCD of this and b. This and b are changed by the computation.
-     */
-    MutableBigInteger hybridGCD(MutableBigInteger b) {
-        // Use Euclid's algorithm until the numbers are approximately the
-        // same length, then use the binary GCD algorithm to find the GCD.
-        MutableBigInteger a = this;
-        MutableBigInteger q = new MutableBigInteger();
-
-        while (b.intLen != 0) {
-            if (Math.abs(a.intLen - b.intLen) < 2)
-                return a.binaryGCD(b);
-
-            MutableBigInteger r = a.divide(b, q);
-            a = b;
-            b = r;
-        }
-        return a;
-    }
-
-    /**
-     * Calculate GCD of this and v.
-     * Assumes that this and v are not zero.
-     */
-    private MutableBigInteger binaryGCD(MutableBigInteger v) {
-        // Algorithm B from Knuth section 4.5.2
-        MutableBigInteger u = this;
-        MutableBigInteger r = new MutableBigInteger();
-
-        // step B1
-        int s1 = u.getLowestSetBit();
-        int s2 = v.getLowestSetBit();
-        int k = (s1 < s2) ? s1 : s2;
-        if (k != 0) {
-            u.rightShift(k);
-            v.rightShift(k);
-        }
-
-        // step B2
-        boolean uOdd = (k==s1);
-        MutableBigInteger t = uOdd ? v: u;
-        int tsign = uOdd ? -1 : 1;
-
-        int lb;
-        while ((lb = t.getLowestSetBit()) >= 0) {
-            // steps B3 and B4
-            t.rightShift(lb);
-            // step B5
-            if (tsign > 0)
-                u = t;
-            else
-                v = t;
-
-            // Special case one word numbers
-            if (u.intLen < 2 && v.intLen < 2) {
-                int x = u.value[u.offset];
-                int y = v.value[v.offset];
-                x  = binaryGcd(x, y);
-                r.value[0] = x;
-                r.intLen = 1;
-                r.offset = 0;
-                if (k > 0)
-                    r.leftShift(k);
-                return r;
-            }
-
-            // step B6
-            if ((tsign = u.difference(v)) == 0)
-                break;
-            t = (tsign >= 0) ? u : v;
-        }
-
-        if (k > 0)
-            u.leftShift(k);
-        return u;
-    }
-
-    /**
-     * Calculate GCD of a and b interpreted as unsigned integers.
-     */
-    static int binaryGcd(int a, int b) {
-        if (b==0)
-            return a;
-        if (a==0)
-            return b;
-
-        // Right shift a & b till their last bits equal to 1.
-        int aZeros = Integer.numberOfTrailingZeros(a);
-        int bZeros = Integer.numberOfTrailingZeros(b);
-        a >>>= aZeros;
-        b >>>= bZeros;
-
-        int t = (aZeros < bZeros ? aZeros : bZeros);
-
-        while (a != b) {
-            if ((a+0x80000000) > (b+0x80000000)) {  // a > b as unsigned
-                a -= b;
-                a >>>= Integer.numberOfTrailingZeros(a);
-            } else {
-                b -= a;
-                b >>>= Integer.numberOfTrailingZeros(b);
-            }
-        }
-        return a<<t;
-    }
-
-    /**
-     * Returns the modInverse of this mod p. This and p are not affected by
-     * the operation.
-     */
-    MutableBigInteger mutableModInverse(MutableBigInteger p) {
-        // Modulus is odd, use Schroeppel's algorithm
-        if (p.isOdd())
-            return modInverse(p);
-
-        // Base and modulus are even, throw exception
-        if (isEven())
-            throw new ArithmeticException("BigInteger not invertible.");
-
-        // Get even part of modulus expressed as a power of 2
-        int powersOf2 = p.getLowestSetBit();
-
-        // Construct odd part of modulus
-        MutableBigInteger oddMod = new MutableBigInteger(p);
-        oddMod.rightShift(powersOf2);
-
-        if (oddMod.isOne())
-            return modInverseMP2(powersOf2);
-
-        // Calculate 1/a mod oddMod
-        MutableBigInteger oddPart = modInverse(oddMod);
-
-        // Calculate 1/a mod evenMod
-        MutableBigInteger evenPart = modInverseMP2(powersOf2);
-
-        // Combine the results using Chinese Remainder Theorem
-        MutableBigInteger y1 = modInverseBP2(oddMod, powersOf2);
-        MutableBigInteger y2 = oddMod.modInverseMP2(powersOf2);
-
-        MutableBigInteger temp1 = new MutableBigInteger();
-        MutableBigInteger temp2 = new MutableBigInteger();
-        MutableBigInteger result = new MutableBigInteger();
-
-        oddPart.leftShift(powersOf2);
-        oddPart.multiply(y1, result);
-
-        evenPart.multiply(oddMod, temp1);
-        temp1.multiply(y2, temp2);
-
-        result.add(temp2);
-        return result.divide(p, temp1);
-    }
-
-    /*
-     * Calculate the multiplicative inverse of this mod 2^k.
-     */
-    MutableBigInteger modInverseMP2(int k) {
-        if (isEven())
-            throw new ArithmeticException("Non-invertible. (GCD != 1)");
-
-        if (k > 64)
-            return euclidModInverse(k);
-
-        int t = inverseMod32(value[offset+intLen-1]);
-
-        if (k < 33) {
-            t = (k == 32 ? t : t & ((1 << k) - 1));
-            return new MutableBigInteger(t);
-        }
-
-        long pLong = (value[offset+intLen-1] & LONG_MASK);
-        if (intLen > 1)
-            pLong |=  ((long)value[offset+intLen-2] << 32);
-        long tLong = t & LONG_MASK;
-        tLong = tLong * (2 - pLong * tLong);  // 1 more Newton iter step
-        tLong = (k == 64 ? tLong : tLong & ((1L << k) - 1));
-
-        MutableBigInteger result = new MutableBigInteger(new int[2]);
-        result.value[0] = (int)(tLong >>> 32);
-        result.value[1] = (int)tLong;
-        result.intLen = 2;
-        result.normalize();
-        return result;
-    }
-
-    /*
-     * Returns the multiplicative inverse of val mod 2^32.  Assumes val is odd.
-     */
-    static int inverseMod32(int val) {
-        // Newton's iteration!
-        int t = val;
-        t *= 2 - val*t;
-        t *= 2 - val*t;
-        t *= 2 - val*t;
-        t *= 2 - val*t;
-        return t;
-    }
-
-    /*
-     * Calculate the multiplicative inverse of 2^k mod mod, where mod is odd.
-     */
-    static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) {
-        // Copy the mod to protect original
-        return fixup(new MutableBigInteger(1), new MutableBigInteger(mod), k);
-    }
-
-    /**
-     * Calculate the multiplicative inverse of this mod mod, where mod is odd.
-     * This and mod are not changed by the calculation.
-     *
-     * This method implements an algorithm due to Richard Schroeppel, that uses
-     * the same intermediate representation as Montgomery Reduction
-     * ("Montgomery Form").  The algorithm is described in an unpublished
-     * manuscript entitled "Fast Modular Reciprocals."
-     */
-    private MutableBigInteger modInverse(MutableBigInteger mod) {
-        MutableBigInteger p = new MutableBigInteger(mod);
-        MutableBigInteger f = new MutableBigInteger(this);
-        MutableBigInteger g = new MutableBigInteger(p);
-        SignedMutableBigInteger c = new SignedMutableBigInteger(1);
-        SignedMutableBigInteger d = new SignedMutableBigInteger();
-        MutableBigInteger temp = null;
-        SignedMutableBigInteger sTemp = null;
-
-        int k = 0;
-        // Right shift f k times until odd, left shift d k times
-        if (f.isEven()) {
-            int trailingZeros = f.getLowestSetBit();
-            f.rightShift(trailingZeros);
-            d.leftShift(trailingZeros);
-            k = trailingZeros;
-        }
-
-        // The Almost Inverse Algorithm
-        while(!f.isOne()) {
-            // If gcd(f, g) != 1, number is not invertible modulo mod
-            if (f.isZero())
-                throw new ArithmeticException("BigInteger not invertible.");
-
-            // If f < g exchange f, g and c, d
-            if (f.compare(g) < 0) {
-                temp = f; f = g; g = temp;
-                sTemp = d; d = c; c = sTemp;
-            }
-
-            // If f == g (mod 4)
-            if (((f.value[f.offset + f.intLen - 1] ^
-                 g.value[g.offset + g.intLen - 1]) & 3) == 0) {
-                f.subtract(g);
-                c.signedSubtract(d);
-            } else { // If f != g (mod 4)
-                f.add(g);
-                c.signedAdd(d);
-            }
-
-            // Right shift f k times until odd, left shift d k times
-            int trailingZeros = f.getLowestSetBit();
-            f.rightShift(trailingZeros);
-            d.leftShift(trailingZeros);
-            k += trailingZeros;
-        }
-
-        while (c.sign < 0)
-           c.signedAdd(p);
-
-        return fixup(c, p, k);
-    }
-
-    /*
-     * The Fixup Algorithm
-     * Calculates X such that X = C * 2^(-k) (mod P)
-     * Assumes C<P and P is odd.
-     */
-    static MutableBigInteger fixup(MutableBigInteger c, MutableBigInteger p,
-                                                                      int k) {
-        MutableBigInteger temp = new MutableBigInteger();
-        // Set r to the multiplicative inverse of p mod 2^32
-        int r = -inverseMod32(p.value[p.offset+p.intLen-1]);
-
-        for(int i=0, numWords = k >> 5; i<numWords; i++) {
-            // V = R * c (mod 2^j)
-            int  v = r * c.value[c.offset + c.intLen-1];
-            // c = c + (v * p)
-            p.mul(v, temp);
-            c.add(temp);
-            // c = c / 2^j
-            c.intLen--;
-        }
-        int numBits = k & 0x1f;
-        if (numBits != 0) {
-            // V = R * c (mod 2^j)
-            int v = r * c.value[c.offset + c.intLen-1];
-            v &= ((1<<numBits) - 1);
-            // c = c + (v * p)
-            p.mul(v, temp);
-            c.add(temp);
-            // c = c / 2^j
-            c.rightShift(numBits);
-        }
-
-        // In theory, c may be greater than p at this point (Very rare!)
-        while (c.compare(p) >= 0)
-            c.subtract(p);
-
-        return c;
-    }
-
-    /**
-     * Uses the extended Euclidean algorithm to compute the modInverse of base
-     * mod a modulus that is a power of 2. The modulus is 2^k.
-     */
-    MutableBigInteger euclidModInverse(int k) {
-        MutableBigInteger b = new MutableBigInteger(1);
-        b.leftShift(k);
-        MutableBigInteger mod = new MutableBigInteger(b);
-
-        MutableBigInteger a = new MutableBigInteger(this);
-        MutableBigInteger q = new MutableBigInteger();
-        MutableBigInteger r = b.divide(a, q);
-
-        MutableBigInteger swapper = b;
-        // swap b & r
-        b = r;
-        r = swapper;
-
-        MutableBigInteger t1 = new MutableBigInteger(q);
-        MutableBigInteger t0 = new MutableBigInteger(1);
-        MutableBigInteger temp = new MutableBigInteger();
-
-        while (!b.isOne()) {
-            r = a.divide(b, q);
-
-            if (r.intLen == 0)
-                throw new ArithmeticException("BigInteger not invertible.");
-
-            swapper = r;
-            a = swapper;
-
-            if (q.intLen == 1)
-                t1.mul(q.value[q.offset], temp);
-            else
-                q.multiply(t1, temp);
-            swapper = q;
-            q = temp;
-            temp = swapper;
-            t0.add(q);
-
-            if (a.isOne())
-                return t0;
-
-            r = b.divide(a, q);
-
-            if (r.intLen == 0)
-                throw new ArithmeticException("BigInteger not invertible.");
-
-            swapper = b;
-            b =  r;
-
-            if (q.intLen == 1)
-                t0.mul(q.value[q.offset], temp);
-            else
-                q.multiply(t0, temp);
-            swapper = q; q = temp; temp = swapper;
-
-            t1.add(q);
-        }
-        mod.subtract(t1);
-        return mod;
-    }
-
-}
diff --git a/ojluni/src/main/java/java/math/RoundingMode.java b/ojluni/src/main/java/java/math/RoundingMode.java
deleted file mode 100755
index 69994a4..0000000
--- a/ojluni/src/main/java/java/math/RoundingMode.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Portions Copyright IBM Corporation, 2001. All Rights Reserved.
- */
-package java.math;
-
-/**
- * Specifies a <i>rounding behavior</i> for numerical operations
- * capable of discarding precision. Each rounding mode indicates how
- * the least significant returned digit of a rounded result is to be
- * calculated.  If fewer digits are returned than the digits needed to
- * represent the exact numerical result, the discarded digits will be
- * referred to as the <i>discarded fraction</i> regardless the digits'
- * contribution to the value of the number.  In other words,
- * considered as a numerical value, the discarded fraction could have
- * an absolute value greater than one.
- *
- * <p>Each rounding mode description includes a table listing how
- * different two-digit decimal values would round to a one digit
- * decimal value under the rounding mode in question.  The result
- * column in the tables could be gotten by creating a
- * {@code BigDecimal} number with the specified value, forming a
- * {@link MathContext} object with the proper settings
- * ({@code precision} set to {@code 1}, and the
- * {@code roundingMode} set to the rounding mode in question), and
- * calling {@link BigDecimal#round round} on this number with the
- * proper {@code MathContext}.  A summary table showing the results
- * of these rounding operations for all rounding modes appears below.
- *
- *<p>
- *<table border>
- * <caption><b>Summary of Rounding Operations Under Different Rounding Modes</b></caption>
- * <tr><th></th><th colspan=8>Result of rounding input to one digit with the given
- *                           rounding mode</th>
- * <tr valign=top>
- * <th>Input Number</th>         <th>{@code UP}</th>
- *                                           <th>{@code DOWN}</th>
- *                                                        <th>{@code CEILING}</th>
- *                                                                       <th>{@code FLOOR}</th>
- *                                                                                    <th>{@code HALF_UP}</th>
- *                                                                                                   <th>{@code HALF_DOWN}</th>
- *                                                                                                                    <th>{@code HALF_EVEN}</th>
- *                                                                                                                                     <th>{@code UNNECESSARY}</th>
- *
- * <tr align=right><td>5.5</td>  <td>6</td>  <td>5</td>    <td>6</td>    <td>5</td>  <td>6</td>      <td>5</td>       <td>6</td>       <td>throw {@code ArithmeticException}</td>
- * <tr align=right><td>2.5</td>  <td>3</td>  <td>2</td>    <td>3</td>    <td>2</td>  <td>3</td>      <td>2</td>       <td>2</td>       <td>throw {@code ArithmeticException}</td>
- * <tr align=right><td>1.6</td>  <td>2</td>  <td>1</td>    <td>2</td>    <td>1</td>  <td>2</td>      <td>2</td>       <td>2</td>       <td>throw {@code ArithmeticException}</td>
- * <tr align=right><td>1.1</td>  <td>2</td>  <td>1</td>    <td>2</td>    <td>1</td>  <td>1</td>      <td>1</td>       <td>1</td>       <td>throw {@code ArithmeticException}</td>
- * <tr align=right><td>1.0</td>  <td>1</td>  <td>1</td>    <td>1</td>    <td>1</td>  <td>1</td>      <td>1</td>       <td>1</td>       <td>1</td>
- * <tr align=right><td>-1.0</td> <td>-1</td> <td>-1</td>   <td>-1</td>   <td>-1</td> <td>-1</td>     <td>-1</td>      <td>-1</td>      <td>-1</td>
- * <tr align=right><td>-1.1</td> <td>-2</td> <td>-1</td>   <td>-1</td>   <td>-2</td> <td>-1</td>     <td>-1</td>      <td>-1</td>      <td>throw {@code ArithmeticException}</td>
- * <tr align=right><td>-1.6</td> <td>-2</td> <td>-1</td>   <td>-1</td>   <td>-2</td> <td>-2</td>     <td>-2</td>      <td>-2</td>      <td>throw {@code ArithmeticException}</td>
- * <tr align=right><td>-2.5</td> <td>-3</td> <td>-2</td>   <td>-2</td>   <td>-3</td> <td>-3</td>     <td>-2</td>      <td>-2</td>      <td>throw {@code ArithmeticException}</td>
- * <tr align=right><td>-5.5</td> <td>-6</td> <td>-5</td>   <td>-5</td>   <td>-6</td> <td>-6</td>     <td>-5</td>      <td>-6</td>      <td>throw {@code ArithmeticException}</td>
- *</table>
- *
- *
- * <p>This {@code enum} is intended to replace the integer-based
- * enumeration of rounding mode constants in {@link BigDecimal}
- * ({@link BigDecimal#ROUND_UP}, {@link BigDecimal#ROUND_DOWN},
- * etc. ).
- *
- * @see     BigDecimal
- * @see     MathContext
- * @author  Josh Bloch
- * @author  Mike Cowlishaw
- * @author  Joseph D. Darcy
- * @since 1.5
- */
-public enum RoundingMode {
-
-        /**
-         * Rounding mode to round away from zero.  Always increments the
-         * digit prior to a non-zero discarded fraction.  Note that this
-         * rounding mode never decreases the magnitude of the calculated
-         * value.
-         *
-         *<p>Example:
-         *<table border>
-         *<tr valign=top><th>Input Number</th>
-         *    <th>Input rounded to one digit<br> with {@code UP} rounding
-         *<tr align=right><td>5.5</td>  <td>6</td>
-         *<tr align=right><td>2.5</td>  <td>3</td>
-         *<tr align=right><td>1.6</td>  <td>2</td>
-         *<tr align=right><td>1.1</td>  <td>2</td>
-         *<tr align=right><td>1.0</td>  <td>1</td>
-         *<tr align=right><td>-1.0</td> <td>-1</td>
-         *<tr align=right><td>-1.1</td> <td>-2</td>
-         *<tr align=right><td>-1.6</td> <td>-2</td>
-         *<tr align=right><td>-2.5</td> <td>-3</td>
-         *<tr align=right><td>-5.5</td> <td>-6</td>
-         *</table>
-         */
-    UP(BigDecimal.ROUND_UP),
-
-        /**
-         * Rounding mode to round towards zero.  Never increments the digit
-         * prior to a discarded fraction (i.e., truncates).  Note that this
-         * rounding mode never increases the magnitude of the calculated value.
-         *
-         *<p>Example:
-         *<table border>
-         *<tr valign=top><th>Input Number</th>
-         *    <th>Input rounded to one digit<br> with {@code DOWN} rounding
-         *<tr align=right><td>5.5</td>  <td>5</td>
-         *<tr align=right><td>2.5</td>  <td>2</td>
-         *<tr align=right><td>1.6</td>  <td>1</td>
-         *<tr align=right><td>1.1</td>  <td>1</td>
-         *<tr align=right><td>1.0</td>  <td>1</td>
-         *<tr align=right><td>-1.0</td> <td>-1</td>
-         *<tr align=right><td>-1.1</td> <td>-1</td>
-         *<tr align=right><td>-1.6</td> <td>-1</td>
-         *<tr align=right><td>-2.5</td> <td>-2</td>
-         *<tr align=right><td>-5.5</td> <td>-5</td>
-         *</table>
-         */
-    DOWN(BigDecimal.ROUND_DOWN),
-
-        /**
-         * Rounding mode to round towards positive infinity.  If the
-         * result is positive, behaves as for {@code RoundingMode.UP};
-         * if negative, behaves as for {@code RoundingMode.DOWN}.  Note
-         * that this rounding mode never decreases the calculated value.
-         *
-         *<p>Example:
-         *<table border>
-         *<tr valign=top><th>Input Number</th>
-         *    <th>Input rounded to one digit<br> with {@code CEILING} rounding
-         *<tr align=right><td>5.5</td>  <td>6</td>
-         *<tr align=right><td>2.5</td>  <td>3</td>
-         *<tr align=right><td>1.6</td>  <td>2</td>
-         *<tr align=right><td>1.1</td>  <td>2</td>
-         *<tr align=right><td>1.0</td>  <td>1</td>
-         *<tr align=right><td>-1.0</td> <td>-1</td>
-         *<tr align=right><td>-1.1</td> <td>-1</td>
-         *<tr align=right><td>-1.6</td> <td>-1</td>
-         *<tr align=right><td>-2.5</td> <td>-2</td>
-         *<tr align=right><td>-5.5</td> <td>-5</td>
-         *</table>
-         */
-    CEILING(BigDecimal.ROUND_CEILING),
-
-        /**
-         * Rounding mode to round towards negative infinity.  If the
-         * result is positive, behave as for {@code RoundingMode.DOWN};
-         * if negative, behave as for {@code RoundingMode.UP}.  Note that
-         * this rounding mode never increases the calculated value.
-         *
-         *<p>Example:
-         *<table border>
-         *<tr valign=top><th>Input Number</th>
-         *    <th>Input rounded to one digit<br> with {@code FLOOR} rounding
-         *<tr align=right><td>5.5</td>  <td>5</td>
-         *<tr align=right><td>2.5</td>  <td>2</td>
-         *<tr align=right><td>1.6</td>  <td>1</td>
-         *<tr align=right><td>1.1</td>  <td>1</td>
-         *<tr align=right><td>1.0</td>  <td>1</td>
-         *<tr align=right><td>-1.0</td> <td>-1</td>
-         *<tr align=right><td>-1.1</td> <td>-2</td>
-         *<tr align=right><td>-1.6</td> <td>-2</td>
-         *<tr align=right><td>-2.5</td> <td>-3</td>
-         *<tr align=right><td>-5.5</td> <td>-6</td>
-         *</table>
-         */
-    FLOOR(BigDecimal.ROUND_FLOOR),
-
-        /**
-         * Rounding mode to round towards {@literal "nearest neighbor"}
-         * unless both neighbors are equidistant, in which case round up.
-         * Behaves as for {@code RoundingMode.UP} if the discarded
-         * fraction is &ge; 0.5; otherwise, behaves as for
-         * {@code RoundingMode.DOWN}.  Note that this is the rounding
-         * mode commonly taught at school.
-         *
-         *<p>Example:
-         *<table border>
-         *<tr valign=top><th>Input Number</th>
-         *    <th>Input rounded to one digit<br> with {@code HALF_UP} rounding
-         *<tr align=right><td>5.5</td>  <td>6</td>
-         *<tr align=right><td>2.5</td>  <td>3</td>
-         *<tr align=right><td>1.6</td>  <td>2</td>
-         *<tr align=right><td>1.1</td>  <td>1</td>
-         *<tr align=right><td>1.0</td>  <td>1</td>
-         *<tr align=right><td>-1.0</td> <td>-1</td>
-         *<tr align=right><td>-1.1</td> <td>-1</td>
-         *<tr align=right><td>-1.6</td> <td>-2</td>
-         *<tr align=right><td>-2.5</td> <td>-3</td>
-         *<tr align=right><td>-5.5</td> <td>-6</td>
-         *</table>
-         */
-    HALF_UP(BigDecimal.ROUND_HALF_UP),
-
-        /**
-         * Rounding mode to round towards {@literal "nearest neighbor"}
-         * unless both neighbors are equidistant, in which case round
-         * down.  Behaves as for {@code RoundingMode.UP} if the discarded
-         * fraction is &gt; 0.5; otherwise, behaves as for
-         * {@code RoundingMode.DOWN}.
-         *
-         *<p>Example:
-         *<table border>
-         *<tr valign=top><th>Input Number</th>
-         *    <th>Input rounded to one digit<br> with {@code HALF_DOWN} rounding
-         *<tr align=right><td>5.5</td>  <td>5</td>
-         *<tr align=right><td>2.5</td>  <td>2</td>
-         *<tr align=right><td>1.6</td>  <td>2</td>
-         *<tr align=right><td>1.1</td>  <td>1</td>
-         *<tr align=right><td>1.0</td>  <td>1</td>
-         *<tr align=right><td>-1.0</td> <td>-1</td>
-         *<tr align=right><td>-1.1</td> <td>-1</td>
-         *<tr align=right><td>-1.6</td> <td>-2</td>
-         *<tr align=right><td>-2.5</td> <td>-2</td>
-         *<tr align=right><td>-5.5</td> <td>-5</td>
-         *</table>
-         */
-    HALF_DOWN(BigDecimal.ROUND_HALF_DOWN),
-
-        /**
-         * Rounding mode to round towards the {@literal "nearest neighbor"}
-         * unless both neighbors are equidistant, in which case, round
-         * towards the even neighbor.  Behaves as for
-         * {@code RoundingMode.HALF_UP} if the digit to the left of the
-         * discarded fraction is odd; behaves as for
-         * {@code RoundingMode.HALF_DOWN} if it's even.  Note that this
-         * is the rounding mode that statistically minimizes cumulative
-         * error when applied repeatedly over a sequence of calculations.
-         * It is sometimes known as {@literal "Banker's rounding,"} and is
-         * chiefly used in the USA.  This rounding mode is analogous to
-         * the rounding policy used for {@code float} and {@code double}
-         * arithmetic in Java.
-         *
-         *<p>Example:
-         *<table border>
-         *<tr valign=top><th>Input Number</th>
-         *    <th>Input rounded to one digit<br> with {@code HALF_EVEN} rounding
-         *<tr align=right><td>5.5</td>  <td>6</td>
-         *<tr align=right><td>2.5</td>  <td>2</td>
-         *<tr align=right><td>1.6</td>  <td>2</td>
-         *<tr align=right><td>1.1</td>  <td>1</td>
-         *<tr align=right><td>1.0</td>  <td>1</td>
-         *<tr align=right><td>-1.0</td> <td>-1</td>
-         *<tr align=right><td>-1.1</td> <td>-1</td>
-         *<tr align=right><td>-1.6</td> <td>-2</td>
-         *<tr align=right><td>-2.5</td> <td>-2</td>
-         *<tr align=right><td>-5.5</td> <td>-6</td>
-         *</table>
-         */
-    HALF_EVEN(BigDecimal.ROUND_HALF_EVEN),
-
-        /**
-         * Rounding mode to assert that the requested operation has an exact
-         * result, hence no rounding is necessary.  If this rounding mode is
-         * specified on an operation that yields an inexact result, an
-         * {@code ArithmeticException} is thrown.
-         *<p>Example:
-         *<table border>
-         *<tr valign=top><th>Input Number</th>
-         *    <th>Input rounded to one digit<br> with {@code UNNECESSARY} rounding
-         *<tr align=right><td>5.5</td>  <td>throw {@code ArithmeticException}</td>
-         *<tr align=right><td>2.5</td>  <td>throw {@code ArithmeticException}</td>
-         *<tr align=right><td>1.6</td>  <td>throw {@code ArithmeticException}</td>
-         *<tr align=right><td>1.1</td>  <td>throw {@code ArithmeticException}</td>
-         *<tr align=right><td>1.0</td>  <td>1</td>
-         *<tr align=right><td>-1.0</td> <td>-1</td>
-         *<tr align=right><td>-1.1</td> <td>throw {@code ArithmeticException}</td>
-         *<tr align=right><td>-1.6</td> <td>throw {@code ArithmeticException}</td>
-         *<tr align=right><td>-2.5</td> <td>throw {@code ArithmeticException}</td>
-         *<tr align=right><td>-5.5</td> <td>throw {@code ArithmeticException}</td>
-         *</table>
-         */
-    UNNECESSARY(BigDecimal.ROUND_UNNECESSARY);
-
-    // Corresponding BigDecimal rounding constant
-    final int oldMode;
-
-    /**
-     * Constructor
-     *
-     * @param oldMode The {@code BigDecimal} constant corresponding to
-     *        this mode
-     */
-    private RoundingMode(int oldMode) {
-        this.oldMode = oldMode;
-    }
-
-    /**
-     * Returns the {@code RoundingMode} object corresponding to a
-     * legacy integer rounding mode constant in {@link BigDecimal}.
-     *
-     * @param  rm legacy integer rounding mode to convert
-     * @return {@code RoundingMode} corresponding to the given integer.
-     * @throws IllegalArgumentException integer is out of range
-     */
-    public static RoundingMode valueOf(int rm) {
-        switch(rm) {
-
-        case BigDecimal.ROUND_UP:
-            return UP;
-
-        case BigDecimal.ROUND_DOWN:
-            return DOWN;
-
-        case BigDecimal.ROUND_CEILING:
-            return CEILING;
-
-        case BigDecimal.ROUND_FLOOR:
-            return FLOOR;
-
-        case BigDecimal.ROUND_HALF_UP:
-            return HALF_UP;
-
-        case BigDecimal.ROUND_HALF_DOWN:
-            return HALF_DOWN;
-
-        case BigDecimal.ROUND_HALF_EVEN:
-            return HALF_EVEN;
-
-        case BigDecimal.ROUND_UNNECESSARY:
-            return UNNECESSARY;
-
-        default:
-            throw new IllegalArgumentException("argument out of range");
-        }
-    }
-}
diff --git a/ojluni/src/main/java/java/math/SignedMutableBigInteger.java b/ojluni/src/main/java/java/math/SignedMutableBigInteger.java
deleted file mode 100755
index a6e5fcd..0000000
--- a/ojluni/src/main/java/java/math/SignedMutableBigInteger.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.math;
-
-/**
- * A class used to represent multiprecision integers that makes efficient
- * use of allocated space by allowing a number to occupy only part of
- * an array so that the arrays do not have to be reallocated as often.
- * When performing an operation with many iterations the array used to
- * hold a number is only increased when necessary and does not have to
- * be the same size as the number it represents. A mutable number allows
- * calculations to occur on the same number without having to create
- * a new number for every step of the calculation as occurs with
- * BigIntegers.
- *
- * Note that SignedMutableBigIntegers only support signed addition and
- * subtraction. All other operations occur as with MutableBigIntegers.
- *
- * @see     BigInteger
- * @author  Michael McCloskey
- * @since   1.3
- */
-
-class SignedMutableBigInteger extends MutableBigInteger {
-
-   /**
-     * The sign of this MutableBigInteger.
-     */
-    int sign = 1;
-
-    // Constructors
-
-    /**
-     * The default constructor. An empty MutableBigInteger is created with
-     * a one word capacity.
-     */
-    SignedMutableBigInteger() {
-        super();
-    }
-
-    /**
-     * Construct a new MutableBigInteger with a magnitude specified by
-     * the int val.
-     */
-    SignedMutableBigInteger(int val) {
-        super(val);
-    }
-
-    /**
-     * Construct a new MutableBigInteger with a magnitude equal to the
-     * specified MutableBigInteger.
-     */
-    SignedMutableBigInteger(MutableBigInteger val) {
-        super(val);
-    }
-
-   // Arithmetic Operations
-
-   /**
-     * Signed addition built upon unsigned add and subtract.
-     */
-    void signedAdd(SignedMutableBigInteger addend) {
-        if (sign == addend.sign)
-            add(addend);
-        else
-            sign = sign * subtract(addend);
-
-    }
-
-   /**
-     * Signed addition built upon unsigned add and subtract.
-     */
-    void signedAdd(MutableBigInteger addend) {
-        if (sign == 1)
-            add(addend);
-        else
-            sign = sign * subtract(addend);
-
-    }
-
-   /**
-     * Signed subtraction built upon unsigned add and subtract.
-     */
-    void signedSubtract(SignedMutableBigInteger addend) {
-        if (sign == addend.sign)
-            sign = sign * subtract(addend);
-        else
-            add(addend);
-
-    }
-
-   /**
-     * Signed subtraction built upon unsigned add and subtract.
-     */
-    void signedSubtract(MutableBigInteger addend) {
-        if (sign == 1)
-            sign = sign * subtract(addend);
-        else
-            add(addend);
-        if (intLen == 0)
-             sign = 1;
-    }
-
-    /**
-     * Print out the first intLen ints of this MutableBigInteger's value
-     * array starting at offset.
-     */
-    public String toString() {
-        return this.toBigInteger(sign).toString();
-    }
-
-}
diff --git a/ojluni/src/main/java/java/math/package-info.java b/ojluni/src/main/java/java/math/package-info.java
deleted file mode 100755
index 377cc25..0000000
--- a/ojluni/src/main/java/java/math/package-info.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Provides classes for performing arbitrary-precision integer
- * arithmetic ({@code BigInteger}) and arbitrary-precision decimal
- * arithmetic ({@code BigDecimal}).  {@code BigInteger} is analogous
- * to the primitive integer types except that it provides arbitrary
- * precision, hence operations on {@code BigInteger}s do not overflow
- * or lose precision.  In addition to standard arithmetic operations,
- * {@code BigInteger} provides modular arithmetic, GCD calculation,
- * primality testing, prime generation, bit manipulation, and a few
- * other miscellaneous operations.
- *
- * {@code BigDecimal} provides arbitrary-precision signed decimal
- * numbers suitable for currency calculations and the like.  {@code
- * BigDecimal} gives the user complete control over rounding behavior,
- * allowing the user to choose from a comprehensive set of eight
- * rounding modes.
- *
- * @since JDK1.1
- */
-package java.math;
diff --git a/ojluni/src/main/java/javax/xml/crypto/AlgorithmMethod.java b/ojluni/src/main/java/javax/xml/crypto/AlgorithmMethod.java
deleted file mode 100755
index 8e93f63..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/AlgorithmMethod.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: AlgorithmMethod.java,v 1.4 2005/05/10 15:47:41 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * An abstract representation of an algorithm defined in the XML Security
- * specifications. Subclasses represent specific types of XML security
- * algorithms, such as a {@link javax.xml.crypto.dsig.Transform}.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public interface AlgorithmMethod {
-
-    /**
-     * Returns the algorithm URI of this <code>AlgorithmMethod</code>.
-     *
-     * @return the algorithm URI of this <code>AlgorithmMethod</code>
-     */
-    String getAlgorithm();
-
-    /**
-     * Returns the algorithm parameters of this <code>AlgorithmMethod</code>.
-     *
-     * @return the algorithm parameters of this <code>AlgorithmMethod</code>.
-     *    Returns <code>null</code> if this <code>AlgorithmMethod</code> does
-     *    not require parameters and they are not specified.
-     */
-    AlgorithmParameterSpec getParameterSpec();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/Data.java b/ojluni/src/main/java/javax/xml/crypto/Data.java
deleted file mode 100755
index 8a5f022..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/Data.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: Data.java,v 1.4 2005/05/10 15:47:41 mullan Exp $
- */
-package javax.xml.crypto;
-
-import javax.xml.crypto.dsig.Transform;
-
-/**
- * An abstract representation of the result of dereferencing a
- * {@link URIReference} or the input/output of subsequent {@link Transform}s.
- * The primary purpose of this interface is to group and provide type safety
- * for all <code>Data</code> subtypes.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public interface Data { }
diff --git a/ojluni/src/main/java/javax/xml/crypto/KeySelector.java b/ojluni/src/main/java/javax/xml/crypto/KeySelector.java
deleted file mode 100755
index a283bf4..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/KeySelector.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: KeySelector.java,v 1.6 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.security.Key;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import javax.xml.crypto.dsig.keyinfo.RetrievalMethod;
-
-/**
- * A selector that finds and returns a key using the data contained in a
- * {@link KeyInfo} object. An example of an implementation of
- * this class is one that searchs a {@link java.security.KeyStore} for
- * trusted keys that match information contained in a <code>KeyInfo</code>.
- *
- * <p>Whether or not the returned key is trusted and the mechanisms
- * used to determine that is implementation-specific.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public abstract class KeySelector {
-
-    /**
-     * The purpose of the key that is to be selected.
-     */
-    public static class Purpose {
-
-        private final String name;
-
-        private Purpose(String name)    { this.name = name; }
-
-        /**
-         * Returns a string representation of this purpose ("sign",
-         * "verify", "encrypt", or "decrypt").
-         *
-         * @return a string representation of this purpose
-         */
-        public String toString()        { return name; }
-
-        /**
-         * A key for signing.
-         */
-        public static final Purpose SIGN = new Purpose("sign");
-        /**
-         * A key for verifying.
-         */
-        public static final Purpose VERIFY = new Purpose("verify");
-        /**
-         * A key for encrypting.
-         */
-        public static final Purpose ENCRYPT = new Purpose("encrypt");
-        /**
-         * A key for decrypting.
-         */
-        public static final Purpose DECRYPT = new Purpose("decrypt");
-    }
-
-    /**
-     * Default no-args constructor; intended for invocation by subclasses only.
-     */
-    protected KeySelector() {}
-
-    /**
-     * Attempts to find a key that satisfies the specified constraints.
-     *
-     * @param keyInfo a <code>KeyInfo</code> (may be <code>null</code>)
-     * @param purpose the key's purpose ({@link Purpose#SIGN},
-     *    {@link Purpose#VERIFY}, {@link Purpose#ENCRYPT}, or
-     *    {@link Purpose#DECRYPT})
-     * @param method the algorithm method that this key is to be used for.
-     *    Only keys that are compatible with the algorithm and meet the
-     *    constraints of the specified algorithm should be returned.
-     * @param context an <code>XMLCryptoContext</code> that may contain
-     *    useful information for finding an appropriate key. If this key
-     *    selector supports resolving {@link RetrievalMethod} types, the
-     *    context's <code>baseURI</code> and <code>dereferencer</code>
-     *    parameters (if specified) should be used by the selector to
-     *    resolve and dereference the URI.
-     * @return the result of the key selector
-     * @throws KeySelectorException if an exceptional condition occurs while
-     *    attempting to find a key. Note that an inability to find a key is not
-     *    considered an exception (<code>null</code> should be
-     *    returned in that case). However, an error condition (ex: network
-     *    communications failure) that prevented the <code>KeySelector</code>
-     *    from finding a potential key should be considered an exception.
-     * @throws ClassCastException if the data type of <code>method</code>
-     *    is not supported by this key selector
-     */
-    public abstract KeySelectorResult select(KeyInfo keyInfo, Purpose purpose,
-        AlgorithmMethod method, XMLCryptoContext context)
-        throws KeySelectorException;
-
-    /**
-     * Returns a <code>KeySelector</code> that always selects the specified
-     * key, regardless of the <code>KeyInfo</code> passed to it.
-     *
-     * @param key the sole key to be stored in the key selector
-     * @return a key selector that always selects the specified key
-     * @throws NullPointerException if <code>key</code> is <code>null</code>
-     */
-    public static KeySelector singletonKeySelector(Key key) {
-        return new SingletonKeySelector(key);
-    }
-
-    private static class SingletonKeySelector extends KeySelector {
-        private final Key key;
-
-        SingletonKeySelector(Key key) {
-            if (key == null) {
-                throw new NullPointerException();
-            }
-            this.key = key;
-        }
-
-        public KeySelectorResult select(KeyInfo keyInfo, Purpose purpose,
-            AlgorithmMethod method, XMLCryptoContext context)
-            throws KeySelectorException {
-
-            return new KeySelectorResult() {
-                public Key getKey() {
-                    return key;
-                }
-            };
-        }
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/KeySelectorException.java b/ojluni/src/main/java/javax/xml/crypto/KeySelectorException.java
deleted file mode 100755
index 5f55297..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/KeySelectorException.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: KeySelectorException.java,v 1.3 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-/**
- * Indicates an exceptional condition thrown by a {@link KeySelector}.
- *
- * <p>A <code>KeySelectorException</code> can contain a cause: another
- * throwable that caused this <code>KeySelectorException</code> to get thrown.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public class KeySelectorException extends Exception {
-
-    private static final long serialVersionUID = -7480033639322531109L;
-
-    /**
-     * The throwable that caused this exception to get thrown, or
-     * <code>null</code> if this exception was not caused by another throwable
-     * or if the causative throwable is unknown.
-     *
-     * @serial
-     */
-    private Throwable cause;
-
-    /**
-     * Constructs a new <code>KeySelectorException</code> with
-     * <code>null</code> as its detail message.
-     */
-    public KeySelectorException() {
-        super();
-    }
-
-    /**
-     * Constructs a new <code>KeySelectorException</code> with the specified
-     * detail message.
-     *
-     * @param message the detail message
-     */
-    public KeySelectorException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new <code>KeySelectorException</code> with the
-     * specified detail message and cause.
-     * <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public KeySelectorException(String message, Throwable cause) {
-        super(message);
-        this.cause = cause;
-    }
-
-    /**
-     * Constructs a new <code>KeySelectorException</code> with the specified
-     * cause and a detail message of
-     * <code>(cause==null ? null : cause.toString())</code>
-     * (which typically contains the class and detail message of
-     * <code>cause</code>).
-     *
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public KeySelectorException(Throwable cause) {
-        super(cause==null ? null : cause.toString());
-        this.cause = cause;
-    }
-
-    /**
-     * Returns the cause of this <code>KeySelectorException</code> or
-     * <code>null</code> if the cause is nonexistent or unknown.  (The
-     * cause is the throwable that caused this
-     * <code>KeySelectorException</code> to get thrown.)
-     *
-     * @return the cause of this <code>KeySelectorException</code> or
-     *         <code>null</code> if the cause is nonexistent or unknown.
-     */
-    public Throwable getCause() {
-        return cause;
-    }
-
-    /**
-     * Prints this <code>KeySelectorException</code>, its backtrace and
-     * the cause's backtrace to the standard error stream.
-     */
-    public void printStackTrace() {
-        super.printStackTrace();
-        //XXX print backtrace of cause
-    }
-
-    /**
-     * Prints this <code>KeySelectorException</code>, its backtrace and
-     * the cause's backtrace to the specified print stream.
-     *
-     * @param s <code>PrintStream</code> to use for output
-     */
-    public void printStackTrace(PrintStream s) {
-        super.printStackTrace(s);
-        //XXX print backtrace of cause
-    }
-
-    /**
-     * Prints this <code>KeySelectorException</code>, its backtrace and
-     * the cause's backtrace to the specified print writer.
-     *
-     * @param s <code>PrintWriter</code> to use for output
-     */
-    public void printStackTrace(PrintWriter s) {
-        super.printStackTrace(s);
-        //XXX print backtrace of cause
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/KeySelectorResult.java b/ojluni/src/main/java/javax/xml/crypto/KeySelectorResult.java
deleted file mode 100755
index 992984d..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/KeySelectorResult.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: KeySelectorResult.java,v 1.3 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.security.Key;
-
-/**
- * The result returned by the {@link KeySelector#select KeySelector.select}
- * method.
- * <p>
- * At a minimum, a <code>KeySelectorResult</code> contains the <code>Key</code>
- * selected by the <code>KeySelector</code>. Implementations of this interface
- * may add methods to return implementation or algorithm specific information,
- * such as a chain of certificates or debugging information.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see KeySelector
- */
-public interface KeySelectorResult {
-
-    /**
-     * Returns the selected key.
-     *
-     * @return the selected key, or <code>null</code> if none can be found
-     */
-    Key getKey();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/MarshalException.java b/ojluni/src/main/java/javax/xml/crypto/MarshalException.java
deleted file mode 100755
index 2f47d5f..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/MarshalException.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: MarshalException.java,v 1.5 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import javax.xml.crypto.dsig.Manifest;
-import javax.xml.crypto.dsig.XMLSignature;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
-
-/**
- * Indicates an exceptional condition that occured during the XML
- * marshalling or unmarshalling process.
- *
- * <p>A <code>MarshalException</code> can contain a cause: another
- * throwable that caused this <code>MarshalException</code> to get thrown.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignature#sign(XMLSignContext)
- * @see XMLSignatureFactory#unmarshalXMLSignature(XMLValidateContext)
- */
-public class MarshalException extends Exception {
-
-    private static final long serialVersionUID = -863185580332643547L;
-
-    /**
-     * The throwable that caused this exception to get thrown, or null if this
-     * exception was not caused by another throwable or if the causative
-     * throwable is unknown.
-     *
-     * @serial
-     */
-    private Throwable cause;
-
-    /**
-     * Constructs a new <code>MarshalException</code> with
-     * <code>null</code> as its detail message.
-     */
-    public MarshalException() {
-        super();
-    }
-
-    /**
-     * Constructs a new <code>MarshalException</code> with the specified
-     * detail message.
-     *
-     * @param message the detail message
-     */
-    public MarshalException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new <code>MarshalException</code> with the
-     * specified detail message and cause.
-     * <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public MarshalException(String message, Throwable cause) {
-        super(message);
-        this.cause = cause;
-    }
-
-    /**
-     * Constructs a new <code>MarshalException</code> with the specified cause
-     * and a detail message of <code>(cause==null ? null : cause.toString())
-     * </code> (which typically contains the class and detail message of
-     * <code>cause</code>).
-     *
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public MarshalException(Throwable cause) {
-        super(cause==null ? null : cause.toString());
-        this.cause = cause;
-    }
-
-    /**
-     * Returns the cause of this <code>MarshalException</code> or
-     * <code>null</code> if the cause is nonexistent or unknown.  (The
-     * cause is the throwable that caused this
-     * <code>MarshalException</code> to get thrown.)
-     *
-     * @return the cause of this <code>MarshalException</code> or
-     *         <code>null</code> if the cause is nonexistent or unknown.
-     */
-    public Throwable getCause() {
-        return cause;
-    }
-
-    /**
-     * Prints this <code>MarshalException</code>, its backtrace and
-     * the cause's backtrace to the standard error stream.
-     */
-    public void printStackTrace() {
-        super.printStackTrace();
-        //XXX print backtrace of cause
-    }
-
-    /**
-     * Prints this <code>MarshalException</code>, its backtrace and
-     * the cause's backtrace to the specified print stream.
-     *
-     * @param s <code>PrintStream</code> to use for output
-     */
-    public void printStackTrace(PrintStream s) {
-        super.printStackTrace(s);
-        //XXX print backtrace of cause
-    }
-
-    /**
-     * Prints this <code>MarshalException</code>, its backtrace and
-     * the cause's backtrace to the specified print writer.
-     *
-     * @param s <code>PrintWriter</code> to use for output
-     */
-    public void printStackTrace(PrintWriter s) {
-        super.printStackTrace(s);
-        //XXX print backtrace of cause
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/NoSuchMechanismException.java b/ojluni/src/main/java/javax/xml/crypto/NoSuchMechanismException.java
deleted file mode 100755
index a303278..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/NoSuchMechanismException.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: NoSuchMechanismException.java,v 1.4 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import javax.xml.crypto.dsig.Manifest;
-import javax.xml.crypto.dsig.XMLSignature;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
-
-/**
- * This exception is thrown when a particular XML mechanism is requested but
- * is not available in the environment.
- *
- * <p>A <code>NoSuchMechanismException</code> can contain a cause: another
- * throwable that caused this <code>NoSuchMechanismException</code> to get
- * thrown.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#getInstance XMLSignatureFactory.getInstance
- * @see KeyInfoFactory#getInstance KeyInfoFactory.getInstance
- */
-public class NoSuchMechanismException extends RuntimeException {
-
-    private static final long serialVersionUID = 4189669069570660166L;
-
-    /**
-     * The throwable that caused this exception to get thrown, or null if this
-     * exception was not caused by another throwable or if the causative
-     * throwable is unknown.
-     *
-     * @serial
-     */
-    private Throwable cause;
-
-    /**
-     * Constructs a new <code>NoSuchMechanismException</code> with
-     * <code>null</code> as its detail message.
-     */
-    public NoSuchMechanismException() {
-        super();
-    }
-
-    /**
-     * Constructs a new <code>NoSuchMechanismException</code> with the
-     * specified detail message.
-     *
-     * @param message the detail message
-     */
-    public NoSuchMechanismException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new <code>NoSuchMechanismException</code> with the
-     * specified detail message and cause.
-     * <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public NoSuchMechanismException(String message, Throwable cause) {
-        super(message);
-        this.cause = cause;
-    }
-
-    /**
-     * Constructs a new <code>NoSuchMechanismException</code> with the
-     * specified cause and a detail message of
-     * <code>(cause==null ? null : cause.toString())</code> (which typically
-     * contains the class and detail message of <code>cause</code>).
-     *
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public NoSuchMechanismException(Throwable cause) {
-        super(cause==null ? null : cause.toString());
-        this.cause = cause;
-    }
-
-    /**
-     * Returns the cause of this <code>NoSuchMechanismException</code> or
-     * <code>null</code> if the cause is nonexistent or unknown.  (The
-     * cause is the throwable that caused this
-     * <code>NoSuchMechanismException</code> to get thrown.)
-     *
-     * @return the cause of this <code>NoSuchMechanismException</code> or
-     *         <code>null</code> if the cause is nonexistent or unknown.
-     */
-    public Throwable getCause() {
-        return cause;
-    }
-
-    /**
-     * Prints this <code>NoSuchMechanismException</code>, its backtrace and
-     * the cause's backtrace to the standard error stream.
-     */
-    public void printStackTrace() {
-        super.printStackTrace();
-        //XXX print backtrace of cause
-    }
-
-    /**
-     * Prints this <code>NoSuchMechanismException</code>, its backtrace and
-     * the cause's backtrace to the specified print stream.
-     *
-     * @param s <code>PrintStream</code> to use for output
-     */
-    public void printStackTrace(PrintStream s) {
-        super.printStackTrace(s);
-        //XXX print backtrace of cause
-    }
-
-    /**
-     * Prints this <code>NoSuchMechanismException</code>, its backtrace and
-     * the cause's backtrace to the specified print writer.
-     *
-     * @param s <code>PrintWriter</code> to use for output
-     */
-    public void printStackTrace(PrintWriter s) {
-        super.printStackTrace(s);
-        //XXX print backtrace of cause
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/NodeSetData.java b/ojluni/src/main/java/javax/xml/crypto/NodeSetData.java
deleted file mode 100755
index a34302a..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/NodeSetData.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: NodeSetData.java,v 1.5 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.util.Iterator;
-
-/**
- * An abstract representation of a <code>Data</code> type containing a
- * node-set. The type (class) and ordering of the nodes contained in the set
- * are not defined by this class; instead that behavior should be
- * defined by <code>NodeSetData</code> subclasses.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public interface NodeSetData extends Data {
-
-    /**
-     * Returns a read-only iterator over the nodes contained in this
-     * <code>NodeSetData</code> in
-     * <a href="http://www.w3.org/TR/1999/REC-xpath-19991116#dt-document-order">
-     * document order</a>. Attempts to modify the returned iterator
-     * via the <code>remove</code> method throw
-     * <code>UnsupportedOperationException</code>.
-     *
-     * @return an <code>Iterator</code> over the nodes in this
-     *    <code>NodeSetData</code> in document order
-     */
-    Iterator iterator();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/OctetStreamData.java b/ojluni/src/main/java/javax/xml/crypto/OctetStreamData.java
deleted file mode 100755
index b83eeb2..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/OctetStreamData.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: OctetStreamData.java,v 1.3 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.io.InputStream;
-
-/**
- * A representation of a <code>Data</code> type containing an octet stream.
- *
- * @since 1.6
- */
-public class OctetStreamData implements Data {
-
-    private InputStream octetStream;
-    private String uri;
-    private String mimeType;
-
-    /**
-     * Creates a new <code>OctetStreamData</code>.
-     *
-     * @param octetStream the input stream containing the octets
-     * @throws NullPointerException if <code>octetStream</code> is
-     *    <code>null</code>
-     */
-    public OctetStreamData(InputStream octetStream) {
-        if (octetStream == null) {
-            throw new NullPointerException("octetStream is null");
-        }
-        this.octetStream = octetStream;
-    }
-
-    /**
-     * Creates a new <code>OctetStreamData</code>.
-     *
-     * @param octetStream the input stream containing the octets
-     * @param uri the URI String identifying the data object (may be
-     *    <code>null</code>)
-     * @param mimeType the MIME type associated with the data object (may be
-     *    <code>null</code>)
-     * @throws NullPointerException if <code>octetStream</code> is
-     *    <code>null</code>
-     */
-    public OctetStreamData(InputStream octetStream, String uri,
-        String mimeType) {
-        if (octetStream == null) {
-            throw new NullPointerException("octetStream is null");
-        }
-        this.octetStream = octetStream;
-        this.uri = uri;
-        this.mimeType = mimeType;
-    }
-
-    /**
-     * Returns the input stream of this <code>OctetStreamData</code>.
-     *
-     * @return the input stream of this <code>OctetStreamData</code>.
-     */
-    public InputStream getOctetStream() {
-        return octetStream;
-    }
-
-    /**
-     * Returns the URI String identifying the data object represented by this
-     * <code>OctetStreamData</code>.
-     *
-     * @return the URI String or <code>null</code> if not applicable
-     */
-    public String getURI() {
-        return uri;
-    }
-
-    /**
-     * Returns the MIME type associated with the data object represented by this
-     * <code>OctetStreamData</code>.
-     *
-     * @return the MIME type or <code>null</code> if not applicable
-     */
-    public String getMimeType() {
-        return mimeType;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/URIDereferencer.java b/ojluni/src/main/java/javax/xml/crypto/URIDereferencer.java
deleted file mode 100755
index 933c380..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/URIDereferencer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * ===========================================================================
- *
- * (C) Copyright IBM Corp. 2003 All Rights Reserved.
- *
- * ===========================================================================
- */
-/*
- * $Id: URIDereferencer.java,v 1.5 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-/**
- * A dereferencer of {@link URIReference}s.
- * <p>
- * The result of dereferencing a <code>URIReference</code> is either an
- * instance of {@link OctetStreamData} or {@link NodeSetData}. Unless the
- * <code>URIReference</code> is a <i>same-document reference</i> as defined
- * in section 4.2 of the W3C Recommendation for XML-Signature Syntax and
- * Processing, the result of dereferencing the <code>URIReference</code>
- * MUST be an <code>OctetStreamData</code>.
- *
- * @author Sean Mullan
- * @author Joyce Leung
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLCryptoContext#setURIDereferencer(URIDereferencer)
- * @see XMLCryptoContext#getURIDereferencer
- */
-public interface URIDereferencer {
-
-    /**
-     * Dereferences the specified <code>URIReference</code> and returns the
-     * dereferenced data.
-     *
-     * @param uriReference the <code>URIReference</code>
-     * @param context an <code>XMLCryptoContext</code> that may
-     *    contain additional useful information for dereferencing the URI. This
-     *    implementation should dereference the specified
-     *    <code>URIReference</code> against the context's <code>baseURI</code>
-     *    parameter, if specified.
-     * @return the dereferenced data
-     * @throws NullPointerException if <code>uriReference</code> or
-     *    <code>context</code> are <code>null</code>
-     * @throws URIReferenceException if an exception occurs while
-     *    dereferencing the specified <code>uriReference</code>
-     */
-    Data dereference(URIReference uriReference, XMLCryptoContext context)
-        throws URIReferenceException;
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/URIReference.java b/ojluni/src/main/java/javax/xml/crypto/URIReference.java
deleted file mode 100755
index 9034d86..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/URIReference.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: URIReference.java,v 1.4 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-/**
- * Identifies a data object via a URI-Reference, as specified by
- * <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>.
- *
- * <p>Note that some subclasses may not have a <code>type</code> attribute
- * and for objects of those types, the {@link #getType} method always returns
- * <code>null</code>.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see URIDereferencer
- */
-public interface URIReference {
-
-    /**
-     * Returns the URI of the referenced data object.
-     *
-     * @return the URI of the data object in RFC 2396 format (may be
-     *    <code>null</code> if not specified)
-     */
-    String getURI();
-
-    /**
-     * Returns the type of data referenced by this URI.
-     *
-     * @return the type (a URI) of the data object (may be <code>null</code>
-     *    if not specified)
-     */
-    String getType();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/URIReferenceException.java b/ojluni/src/main/java/javax/xml/crypto/URIReferenceException.java
deleted file mode 100755
index 5433185..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/URIReferenceException.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: URIReferenceException.java,v 1.4 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import javax.xml.crypto.dsig.keyinfo.RetrievalMethod;
-
-/**
- * Indicates an exceptional condition thrown while dereferencing a
- * {@link URIReference}.
- *
- * <p>A <code>URIReferenceException</code> can contain a cause: another
- * throwable that caused this <code>URIReferenceException</code> to get thrown.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see URIDereferencer#dereference(URIReference, XMLCryptoContext)
- * @see RetrievalMethod#dereference(XMLCryptoContext)
- */
-public class URIReferenceException extends Exception {
-
-    private static final long serialVersionUID = 7173469703932561419L;
-
-    /**
-     * The throwable that caused this exception to get thrown, or null if this
-     * exception was not caused by another throwable or if the causative
-     * throwable is unknown.
-     *
-     * @serial
-     */
-    private Throwable cause;
-
-    private URIReference uriReference;
-
-    /**
-     * Constructs a new <code>URIReferenceException</code> with
-     * <code>null</code> as its detail message.
-     */
-    public URIReferenceException() {
-        super();
-    }
-
-    /**
-     * Constructs a new <code>URIReferenceException</code> with the specified
-     * detail message.
-     *
-     * @param message the detail message
-     */
-    public URIReferenceException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new <code>URIReferenceException</code> with the
-     * specified detail message and cause.
-     * <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public URIReferenceException(String message, Throwable cause) {
-        super(message);
-        this.cause = cause;
-    }
-
-    /**
-     * Constructs a new <code>URIReferenceException</code> with the
-     * specified detail message, cause and <code>URIReference</code>.
-     * <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     * @param uriReference the <code>URIReference</code> that was being
-     *    dereferenced when the error was encountered
-     * @throws NullPointerException if <code>uriReference</code> is
-     *    <code>null</code>
-     */
-    public URIReferenceException(String message, Throwable cause,
-        URIReference uriReference) {
-        this(message, cause);
-        if (uriReference == null) {
-            throw new NullPointerException("uriReference cannot be null");
-        }
-        this.uriReference = uriReference;
-    }
-
-    /**
-     * Constructs a new <code>URIReferenceException</code> with the specified
-     * cause and a detail message of <code>(cause==null ? null :
-     * cause.toString())</code> (which typically contains the class and detail
-     * message of <code>cause</code>).
-     *
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public URIReferenceException(Throwable cause) {
-        super(cause==null ? null : cause.toString());
-        this.cause = cause;
-    }
-
-    /**
-     * Returns the <code>URIReference</code> that was being dereferenced
-     * when the exception was thrown.
-     *
-     * @return the <code>URIReference</code> that was being dereferenced
-     * when the exception was thrown, or <code>null</code> if not specified
-     */
-    public URIReference getURIReference() {
-        return uriReference;
-    }
-
-    /**
-     * Returns the cause of this <code>URIReferenceException</code> or
-     * <code>null</code> if the cause is nonexistent or unknown.  (The
-     * cause is the throwable that caused this
-     * <code>URIReferenceException</code> to get thrown.)
-     *
-     * @return the cause of this <code>URIReferenceException</code> or
-     *    <code>null</code> if the cause is nonexistent or unknown.
-     */
-    public Throwable getCause() {
-        return cause;
-    }
-
-    /**
-     * Prints this <code>URIReferenceException</code>, its backtrace and
-     * the cause's backtrace to the standard error stream.
-     */
-    public void printStackTrace() {
-        super.printStackTrace();
-        //XXX print backtrace of cause
-    }
-
-    /**
-     * Prints this <code>URIReferenceException</code>, its backtrace and
-     * the cause's backtrace to the specified print stream.
-     *
-     * @param s <code>PrintStream</code> to use for output
-     */
-    public void printStackTrace(PrintStream s) {
-        super.printStackTrace(s);
-        //XXX print backtrace of cause
-    }
-
-    /**
-     * Prints this <code>URIReferenceException</code>, its backtrace and
-     * the cause's backtrace to the specified print writer.
-     *
-     * @param s <code>PrintWriter</code> to use for output
-     */
-    public void printStackTrace(PrintWriter s) {
-        super.printStackTrace(s);
-        //XXX print backtrace of cause
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/XMLCryptoContext.java b/ojluni/src/main/java/javax/xml/crypto/XMLCryptoContext.java
deleted file mode 100755
index 034737f..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/XMLCryptoContext.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XMLCryptoContext.java,v 1.6 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-/**
- * Contains common context information for XML cryptographic operations.
- *
- * <p>This interface contains methods for setting and retrieving properties
- * that affect the processing of XML signatures or XML encrypted structures.
- *
- * <p>Note that <code>XMLCryptoContext</code> instances can contain information
- * and state specific to the XML cryptographic structure it is used with.
- * The results are unpredictable if an <code>XMLCryptoContext</code> is
- * used with multiple structures (for example, you should not use the same
- * {@link javax.xml.crypto.dsig.XMLValidateContext} instance to validate two
- * different {@link javax.xml.crypto.dsig.XMLSignature} objects).
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public interface XMLCryptoContext {
-
-    /**
-     * Returns the base URI.
-     *
-     * @return the base URI, or <code>null</code> if not specified
-     * @see #setBaseURI(String)
-     */
-    String getBaseURI();
-
-    /**
-     * Sets the base URI.
-     *
-     * @param baseURI the base URI, or <code>null</code> to remove current
-     *    value
-     * @throws IllegalArgumentException if <code>baseURI</code> is not RFC
-     *    2396 compliant
-     * @see #getBaseURI
-     */
-    void setBaseURI(String baseURI);
-
-    /**
-     * Returns the key selector for finding a key.
-     *
-     * @return the key selector, or <code>null</code> if not specified
-     * @see #setKeySelector(KeySelector)
-     */
-    KeySelector getKeySelector();
-
-    /**
-     * Sets the key selector for finding a key.
-     *
-     * @param ks the key selector, or <code>null</code> to remove the current
-     *    setting
-     * @see #getKeySelector
-     */
-    void setKeySelector(KeySelector ks);
-
-    /**
-     * Returns a <code>URIDereferencer</code> that is used to dereference
-     * {@link URIReference}s.
-     *
-     * @return the <code>URIDereferencer</code>, or <code>null</code> if not
-     *    specified
-     * @see #setURIDereferencer(URIDereferencer)
-     */
-    URIDereferencer getURIDereferencer();
-
-    /**
-     * Sets a <code>URIDereferencer</code> that is used to dereference
-     * {@link URIReference}s. The specified <code>URIDereferencer</code>
-     * is used in place of an implementation's default
-     * <code>URIDereferencer</code>.
-     *
-     * @param dereferencer the <code>URIDereferencer</code>, or
-     *    <code>null</code> to remove any current setting
-     * @see #getURIDereferencer
-     */
-    void setURIDereferencer(URIDereferencer dereferencer);
-
-    /**
-     * Returns the namespace prefix that the specified namespace URI is
-     * associated with. Returns the specified default prefix if the specified
-     * namespace URI has not been bound to a prefix. To bind a namespace URI
-     * to a prefix, call the {@link #putNamespacePrefix putNamespacePrefix}
-     * method.
-     *
-     * @param namespaceURI a namespace URI
-     * @param defaultPrefix the prefix to be returned in the event that the
-     *    the specified namespace URI has not been bound to a prefix.
-     * @return the prefix that is associated with the specified namespace URI,
-     *    or <code>defaultPrefix</code> if the URI is not registered. If
-     *    the namespace URI is registered but has no prefix, an empty string
-     *    (<code>""</code>) is returned.
-     * @throws NullPointerException if <code>namespaceURI</code> is
-     *    <code>null</code>
-     * @see #putNamespacePrefix(String, String)
-     */
-    String getNamespacePrefix(String namespaceURI, String defaultPrefix);
-
-    /**
-     * Maps the specified namespace URI to the specified prefix. If there is
-     * already a prefix associated with the specified namespace URI, the old
-     * prefix is replaced by the specified prefix.
-     *
-     * @param namespaceURI a namespace URI
-     * @param prefix a namespace prefix (or <code>null</code> to remove any
-     *    existing mapping). Specifying the empty string (<code>""</code>)
-     *    binds no prefix to the namespace URI.
-     * @return the previous prefix associated with the specified namespace
-     *    URI, or <code>null</code> if there was none
-     * @throws NullPointerException if <code>namespaceURI</code> is
-     *    <code>null</code>
-     * @see #getNamespacePrefix(String, String)
-     */
-    String putNamespacePrefix(String namespaceURI, String prefix);
-
-    /**
-     * Returns the default namespace prefix. The default namespace prefix
-     * is the prefix for all namespace URIs not explicitly set by the
-     * {@link #putNamespacePrefix putNamespacePrefix} method.
-     *
-     * @return the default namespace prefix, or <code>null</code> if none has
-     *    been set.
-     * @see #setDefaultNamespacePrefix(String)
-     */
-    String getDefaultNamespacePrefix();
-
-    /**
-     * Sets the default namespace prefix. This sets the namespace prefix for
-     * all namespace URIs not explicitly set by the {@link #putNamespacePrefix
-     * putNamespacePrefix} method.
-     *
-     * @param defaultPrefix the default namespace prefix, or <code>null</code>
-     *    to remove the current setting. Specify the empty string
-     *    (<code>""</code>) to bind no prefix.
-     * @see #getDefaultNamespacePrefix
-     */
-    void setDefaultNamespacePrefix(String defaultPrefix);
-
-    /**
-     * Sets the specified property.
-     *
-     * @param name the name of the property
-     * @param value the value of the property to be set
-     * @return the previous value of the specified property, or
-     *    <code>null</code> if it did not have a value
-     * @throws NullPointerException if <code>name</code> is <code>null</code>
-     * @see #getProperty(String)
-     */
-    Object setProperty(String name, Object value);
-
-    /**
-     * Returns the value of the specified property.
-     *
-     * @param name the name of the property
-     * @return the current value of the specified property, or
-     *    <code>null</code> if it does not have a value
-     * @throws NullPointerException if <code>name</code> is <code>null</code>
-     * @see #setProperty(String, Object)
-     */
-    Object getProperty(String name);
-
-    /**
-     * Returns the value to which this context maps the specified key.
-     *
-     * <p>More formally, if this context contains a mapping from a key
-     * <code>k</code> to a value <code>v</code> such that
-     * <code>(key==null ? k==null : key.equals(k))</code>, then this method
-     * returns <code>v</code>; otherwise it returns <code>null</code>. (There
-     * can be at most one such mapping.)
-     *
-     * <p>This method is useful for retrieving arbitrary information that is
-     * specific to the cryptographic operation that this context is used for.
-     *
-     * @param key the key whose associated value is to be returned
-     * @return the value to which this context maps the specified key, or
-     *    <code>null</code> if there is no mapping for the key
-     * @see #put(Object, Object)
-     */
-    Object get(Object key);
-
-    /**
-     * Associates the specified value with the specified key in this context.
-     * If the context previously contained a mapping for this key, the old
-     * value is replaced by the specified value.
-     *
-     * <p>This method is useful for storing arbitrary information that is
-     * specific to the cryptographic operation that this context is used for.
-     *
-     * @param key key with which the specified value is to be associated with
-     * @param value value to be associated with the specified key
-     * @return the previous value associated with the key, or <code>null</code>
-     *    if there was no mapping for the key
-     * @throws IllegalArgumentException if some aspect of this key or value
-     *    prevents it from being stored in this context
-     * @see #get(Object)
-     */
-    Object put(Object key, Object value);
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/XMLStructure.java b/ojluni/src/main/java/javax/xml/crypto/XMLStructure.java
deleted file mode 100755
index 7aca1d0..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/XMLStructure.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XMLStructure.java,v 1.3 2005/05/10 15:47:42 mullan Exp $
- */
-package javax.xml.crypto;
-
-/**
- * A representation of an XML structure from any namespace. The purpose of
- * this interface is to group (and provide type safety for) all
- * representations of XML structures.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public interface XMLStructure {
-
-    /**
-     * Indicates whether a specified feature is supported.
-     *
-     * @param feature the feature name (as an absolute URI)
-     * @return <code>true</code> if the specified feature is supported,
-     *    <code>false</code> otherwise
-     * @throws NullPointerException if <code>feature</code> is <code>null</code>
-     */
-    boolean isFeatureSupported(String feature);
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dom/DOMCryptoContext.java b/ojluni/src/main/java/javax/xml/crypto/dom/DOMCryptoContext.java
deleted file mode 100755
index 79f7294..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dom/DOMCryptoContext.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: DOMCryptoContext.java,v 1.3 2005/05/09 18:33:26 mullan Exp $
- */
-package javax.xml.crypto.dom;
-
-import javax.xml.crypto.KeySelector;
-import javax.xml.crypto.URIDereferencer;
-import javax.xml.crypto.XMLCryptoContext;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import org.w3c.dom.Element;
-
-/**
- * This class provides a DOM-specific implementation of the
- * {@link XMLCryptoContext} interface. It also includes additional
- * methods that are specific to a DOM-based implementation for registering
- * and retrieving elements that contain attributes of type ID.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public class DOMCryptoContext implements XMLCryptoContext {
-
-    private HashMap nsMap = new HashMap();
-    private HashMap idMap = new HashMap();
-    private HashMap objMap = new HashMap();
-    private String baseURI;
-    private KeySelector ks;
-    private URIDereferencer dereferencer;
-    private HashMap propMap = new HashMap();
-    private String defaultPrefix;
-
-    /**
-     * Default constructor. (For invocation by subclass constructors).
-     */
-    protected DOMCryptoContext() {}
-
-    /**
-     * This implementation uses an internal {@link HashMap} to get the prefix
-     * that the specified URI maps to. It returns the <code>defaultPrefix</code>
-     * if it maps to <code>null</code>.
-     *
-     * @throws NullPointerException {@inheritDoc}
-     */
-    public String getNamespacePrefix(String namespaceURI,
-        String defaultPrefix) {
-        if (namespaceURI == null) {
-            throw new NullPointerException("namespaceURI cannot be null");
-        }
-        String prefix = (String) nsMap.get(namespaceURI);
-        return (prefix != null ? prefix : defaultPrefix);
-    }
-
-    /**
-     * This implementation uses an internal {@link HashMap} to map the URI
-     * to the specified prefix.
-     *
-     * @throws NullPointerException {@inheritDoc}
-     */
-    public String putNamespacePrefix(String namespaceURI, String prefix) {
-        if (namespaceURI == null) {
-            throw new NullPointerException("namespaceURI is null");
-        }
-        return (String) nsMap.put(namespaceURI, prefix);
-    }
-
-    public String getDefaultNamespacePrefix() {
-        return defaultPrefix;
-    }
-
-    public void setDefaultNamespacePrefix(String defaultPrefix) {
-        this.defaultPrefix = defaultPrefix;
-    }
-
-    public String getBaseURI() {
-        return baseURI;
-    }
-
-    /**
-     * @throws IllegalArgumentException {@inheritDoc}
-     */
-    public void setBaseURI(String baseURI) {
-        if (baseURI != null) {
-            java.net.URI.create(baseURI);
-        }
-        this.baseURI = baseURI;
-    }
-
-    public URIDereferencer getURIDereferencer() {
-        return dereferencer;
-    }
-
-    public void setURIDereferencer(URIDereferencer dereferencer) {
-        this.dereferencer = dereferencer;
-    }
-
-    /**
-     * This implementation uses an internal {@link HashMap} to get the object
-     * that the specified name maps to.
-     *
-     * @throws NullPointerException {@inheritDoc}
-     */
-    public Object getProperty(String name) {
-        if (name == null) {
-            throw new NullPointerException("name is null");
-        }
-        return propMap.get(name);
-    }
-
-    /**
-     * This implementation uses an internal {@link HashMap} to map the name
-     * to the specified object.
-     *
-     * @throws NullPointerException {@inheritDoc}
-     */
-    public Object setProperty(String name, Object value) {
-        if (name == null) {
-            throw new NullPointerException("name is null");
-        }
-        return propMap.put(name, value);
-    }
-
-    public KeySelector getKeySelector() {
-        return ks;
-    }
-
-    public void setKeySelector(KeySelector ks) {
-        this.ks = ks;
-    }
-
-    /**
-     * Returns the <code>Element</code> with the specified ID attribute value.
-     *
-     * <p>This implementation uses an internal {@link HashMap} to get the
-     * element that the specified attribute value maps to.
-     *
-     * @param idValue the value of the ID
-     * @return the <code>Element</code> with the specified ID attribute value,
-     *    or <code>null</code> if none.
-     * @throws NullPointerException if <code>idValue</code> is <code>null</code>
-     * @see #setIdAttributeNS
-     */
-    public Element getElementById(String idValue) {
-        if (idValue == null) {
-            throw new NullPointerException("idValue is null");
-        }
-        return (Element) idMap.get(idValue);
-    }
-
-    /**
-     * Registers the element's attribute specified by the namespace URI and
-     * local name to be of type ID. The attribute must have a non-empty value.
-     *
-     * <p>This implementation uses an internal {@link HashMap} to map the
-     * attribute's value to the specified element.
-     *
-     * @param element the element
-     * @param namespaceURI the namespace URI of the attribute (specify
-     *    <code>null</code> if not applicable)
-     * @param localName the local name of the attribute
-     * @throws IllegalArgumentException if <code>localName</code> is not an
-     *    attribute of the specified element or it does not contain a specific
-     *    value
-     * @throws NullPointerException if <code>element</code> or
-     *    <code>localName</code> is <code>null</code>
-     * @see #getElementById
-     */
-    public void setIdAttributeNS(Element element, String namespaceURI,
-        String localName) {
-        if (element == null) {
-            throw new NullPointerException("element is null");
-        }
-        if (localName == null) {
-            throw new NullPointerException("localName is null");
-        }
-        String idValue = element.getAttributeNS(namespaceURI, localName);
-        if (idValue == null || idValue.length() == 0) {
-            throw new IllegalArgumentException(localName + " is not an " +
-                "attribute");
-        }
-        idMap.put(idValue, element);
-    }
-
-    /**
-     * Returns a read-only iterator over the set of Id/Element mappings of
-     * this <code>DOMCryptoContext</code>. Attempts to modify the set via the
-     * {@link Iterator#remove} method throw an
-     * <code>UnsupportedOperationException</code>. The mappings are returned
-     * in no particular order. Each element in the iteration is represented as a
-     * {@link java.util.Map.Entry}. If the <code>DOMCryptoContext</code> is
-     * modified while an iteration is in progress, the results of the
-     * iteration are undefined.
-     *
-     * @return a read-only iterator over the set of mappings
-     */
-    public Iterator iterator() {
-        return Collections.unmodifiableMap(idMap).entrySet().iterator();
-    }
-
-    /**
-     * This implementation uses an internal {@link HashMap} to get the object
-     * that the specified key maps to.
-     */
-    public Object get(Object key) {
-        return objMap.get(key);
-    }
-
-    /**
-     * This implementation uses an internal {@link HashMap} to map the key
-     * to the specified object.
-     *
-     * @throws IllegalArgumentException {@inheritDoc}
-     */
-    public Object put(Object key, Object value) {
-        return objMap.put(key, value);
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dom/DOMStructure.java b/ojluni/src/main/java/javax/xml/crypto/dom/DOMStructure.java
deleted file mode 100755
index 64a1526..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dom/DOMStructure.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: DOMStructure.java,v 1.6 2005/05/09 18:33:26 mullan Exp $
- */
-package javax.xml.crypto.dom;
-
-import org.w3c.dom.Node;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dsig.XMLSignature;
-
-/**
- * A DOM-specific {@link XMLStructure}. The purpose of this class is to
- * allow a DOM node to be used to represent extensible content (any elements
- * or mixed content) in XML Signature structures.
- *
- * <p>If a sequence of nodes is needed, the node contained in the
- * <code>DOMStructure</code> is the first node of the sequence and successive
- * nodes can be accessed by invoking {@link Node#getNextSibling}.
- *
- * <p>If the owner document of the <code>DOMStructure</code> is different than
- * the target document of an <code>XMLSignature</code>, the
- * {@link XMLSignature#sign(XMLSignContext)} method imports the node into the
- * target document before generating the signature.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public class DOMStructure implements XMLStructure {
-
-    private final Node node;
-
-    /**
-     * Creates a <code>DOMStructure</code> containing the specified node.
-     *
-     * @param node the node
-     * @throws NullPointerException if <code>node</code> is <code>null</code>
-     */
-    public DOMStructure(Node node) {
-        if (node == null) {
-            throw new NullPointerException("node cannot be null");
-        }
-        this.node = node;
-    }
-
-    /**
-     * Returns the node contained in this <code>DOMStructure</code>.
-     *
-     * @return the node
-     */
-    public Node getNode() {
-        return node;
-    }
-
-    /**
-     * @throws NullPointerException {@inheritDoc}
-     */
-    public boolean isFeatureSupported(String feature) {
-        if (feature == null) {
-            throw new NullPointerException();
-        } else {
-            return false;
-        }
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dom/DOMURIReference.java b/ojluni/src/main/java/javax/xml/crypto/dom/DOMURIReference.java
deleted file mode 100755
index 6543707..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dom/DOMURIReference.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: DOMURIReference.java,v 1.5 2005/05/09 18:33:26 mullan Exp $
- */
-package javax.xml.crypto.dom;
-
-import javax.xml.crypto.URIReference;
-import org.w3c.dom.Node;
-
-/**
- * A DOM-specific {@link URIReference}. The purpose of this class is to
- * provide additional context necessary for resolving XPointer URIs or
- * same-document references.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public interface DOMURIReference extends URIReference {
-
-    /**
-     * Returns the here node.
-     *
-     * @return the attribute or processing instruction node or the
-     *    parent element of the text node that directly contains the URI
-     */
-    Node getHere();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dom/package.html b/ojluni/src/main/java/javax/xml/crypto/dom/package.html
deleted file mode 100755
index 4758373..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dom/package.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body>
-DOM-specific classes for the {@link javax.xml.crypto} package. 
-Only users who are using a DOM-based XML cryptographic implementations (ex: 
-{@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or 
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory}) 
-should need to make direct use of this package.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-<p>
-<dl>
-<dt><b>Since:</b></dt>
-  <dd>1.6</dd>
-</dl>
-
-</body>
-</html>
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/CanonicalizationMethod.java b/ojluni/src/main/java/javax/xml/crypto/dsig/CanonicalizationMethod.java
deleted file mode 100755
index 33e361c..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/CanonicalizationMethod.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: CanonicalizationMethod.java,v 1.6 2005/05/10 16:03:45 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import java.security.spec.AlgorithmParameterSpec;
-import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
-
-/**
- * A representation of the XML <code>CanonicalizationMethod</code>
- * element as defined in the
- * <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>. The XML
- * Schema Definition is defined as:
- * <p>
- * <pre>
- *   &lt;element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/&gt;
- *     &lt;complexType name="CanonicalizationMethodType" mixed="true"&gt;
- *       &lt;sequence&gt;
- *         &lt;any namespace="##any" minOccurs="0" maxOccurs="unbounded"/&gt;
- *           &lt;!-- (0,unbounded) elements from (1,1) namespace --&gt;
- *       &lt;/sequence&gt;
- *       &lt;attribute name="Algorithm" type="anyURI" use="required"/&gt;
- *     &lt;/complexType&gt;
- * </pre>
- *
- * A <code>CanonicalizationMethod</code> instance may be created by invoking
- * the {@link XMLSignatureFactory#newCanonicalizationMethod
- * newCanonicalizationMethod} method of the {@link XMLSignatureFactory} class.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newCanonicalizationMethod(String, C14NMethodParameterSpec)
- */
-public interface CanonicalizationMethod extends Transform {
-
-    /**
-     * The <a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">Canonical
-     * XML (without comments)</a> canonicalization method algorithm URI.
-     */
-    final static String INCLUSIVE =
-        "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
-
-    /**
-     * The
-     * <a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments">
-     * Canonical XML with comments</a> canonicalization method algorithm URI.
-     */
-    final static String INCLUSIVE_WITH_COMMENTS =
-        "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
-
-    /**
-     * The <a href="http://www.w3.org/2001/10/xml-exc-c14n#">Exclusive
-     * Canonical XML (without comments)</a> canonicalization method algorithm
-     * URI.
-     */
-    final static String EXCLUSIVE =
-        "http://www.w3.org/2001/10/xml-exc-c14n#";
-
-    /**
-     * The <a href="http://www.w3.org/2001/10/xml-exc-c14n#WithComments">
-     * Exclusive Canonical XML with comments</a> canonicalization method
-     * algorithm URI.
-     */
-    final static String EXCLUSIVE_WITH_COMMENTS =
-        "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
-
-    /**
-     * Returns the algorithm-specific input parameters associated with this
-     * <code>CanonicalizationMethod</code>.
-     *
-     * <p>The returned parameters can be typecast to a
-     * {@link C14NMethodParameterSpec} object.
-     *
-     * @return the algorithm-specific input parameters (may be
-     *    <code>null</code> if not specified)
-     */
-    AlgorithmParameterSpec getParameterSpec();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/DigestMethod.java b/ojluni/src/main/java/javax/xml/crypto/dsig/DigestMethod.java
deleted file mode 100755
index 1b6be19..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/DigestMethod.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: DigestMethod.java,v 1.6 2005/05/10 16:03:46 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.AlgorithmMethod;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dsig.spec.DigestMethodParameterSpec;
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A representation of the XML <code>DigestMethod</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * The XML Schema Definition is defined as:
- * <p>
- * <pre>
- *   &lt;element name="DigestMethod" type="ds:DigestMethodType"/&gt;
- *     &lt;complexType name="DigestMethodType" mixed="true"&gt;
- *       &lt;sequence&gt;
- *         &lt;any namespace="##any" minOccurs="0" maxOccurs="unbounded"/&gt;
- *           &lt;!-- (0,unbounded) elements from (1,1) namespace --&gt;
- *       &lt;/sequence&gt;
- *       &lt;attribute name="Algorithm" type="anyURI" use="required"/&gt;
- *     &lt;/complexType&gt;
- * </pre>
- *
- * A <code>DigestMethod</code> instance may be created by invoking the
- * {@link XMLSignatureFactory#newDigestMethod newDigestMethod} method
- * of the {@link XMLSignatureFactory} class.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newDigestMethod(String, DigestMethodParameterSpec)
- */
-public interface DigestMethod extends XMLStructure, AlgorithmMethod {
-
-    /**
-     * The <a href="http://www.w3.org/2000/09/xmldsig#sha1">
-     * SHA1</a> digest method algorithm URI.
-     */
-    static final String SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
-
-    /**
-     * The <a href="http://www.w3.org/2001/04/xmlenc#sha256">
-     * SHA256</a> digest method algorithm URI.
-     */
-    static final String SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
-
-    /**
-     * The <a href="http://www.w3.org/2001/04/xmlenc#sha512">
-     * SHA512</a> digest method algorithm URI.
-     */
-    static final String SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";
-
-    /**
-     * The <a href="http://www.w3.org/2001/04/xmlenc#ripemd160">
-     * RIPEMD-160</a> digest method algorithm URI.
-     */
-    static final String RIPEMD160 = "http://www.w3.org/2001/04/xmlenc#ripemd160";
-
-    /**
-     * Returns the algorithm-specific input parameters associated with this
-     * <code>DigestMethod</code>.
-     *
-     * <p>The returned parameters can be typecast to a {@link
-     * DigestMethodParameterSpec} object.
-     *
-     * @return the algorithm-specific parameters (may be <code>null</code> if
-     *    not specified)
-     */
-    AlgorithmParameterSpec getParameterSpec();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/Manifest.java b/ojluni/src/main/java/javax/xml/crypto/dsig/Manifest.java
deleted file mode 100755
index ebb0ec1..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/Manifest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: Manifest.java,v 1.7 2005/05/10 16:03:46 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.XMLStructure;
-import java.util.List;
-
-/**
- * A representation of the XML <code>Manifest</code> element as defined in
- * the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * The XML Schema Definition is defined as:
- * <pre><code>
- * &lt;element name="Manifest" type="ds:ManifestType"/&gt;
- *   &lt;complexType name="ManifestType"&gt;
- *     &lt;sequence>
- *       &lt;element ref="ds:Reference" maxOccurs="unbounded"/&gt;
- *     &lt;/sequence&gt;
- *     &lt;attribute name="Id" type="ID" use="optional"/&gt;
- *   &lt;/complexType&gt;
- * </code></pre>
- *
- * A <code>Manifest</code> instance may be created by invoking
- * one of the {@link XMLSignatureFactory#newManifest newManifest}
- * methods of the {@link XMLSignatureFactory} class; for example:
- *
- * <pre>
- *   XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
- *   List references = Collections.singletonList(factory.newReference
- *       ("#reference-1", DigestMethod.SHA1));
- *   Manifest manifest = factory.newManifest(references, "manifest-1");
- * </pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newManifest(List)
- * @see XMLSignatureFactory#newManifest(List, String)
- */
-public interface Manifest extends XMLStructure {
-
-    /**
-     * URI that identifies the <code>Manifest</code> element (this can be
-     * specified as the value of the <code>type</code> parameter of the
-     * {@link Reference} class to identify the referent's type).
-     */
-    final static String TYPE = "http://www.w3.org/2000/09/xmldsig#Manifest";
-
-    /**
-     * Returns the Id of this <code>Manifest</code>.
-     *
-     * @return the Id  of this <code>Manifest</code> (or <code>null</code>
-     *    if not specified)
-     */
-    String getId();
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} of one or more {@link Reference}s that are contained in this
-     * <code>Manifest</code>.
-     *
-     * @return an unmodifiable list of one or more <code>Reference</code>s
-     */
-    List getReferences();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/Reference.java b/ojluni/src/main/java/javax/xml/crypto/dsig/Reference.java
deleted file mode 100755
index 6725b14..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/Reference.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: Reference.java,v 1.9 2005/05/10 16:03:46 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.Data;
-import javax.xml.crypto.URIReference;
-import javax.xml.crypto.XMLStructure;
-import java.io.InputStream;
-import java.util.List;
-
-/**
- * A representation of the <code>Reference</code> element as defined in the
- * <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * The XML schema is defined as:
- * <code><pre>
- * &lt;element name="Reference" type="ds:ReferenceType"/&gt;
- * &lt;complexType name="ReferenceType"&gt;
- *   &lt;sequence&gt;
- *     &lt;element ref="ds:Transforms" minOccurs="0"/&gt;
- *     &lt;element ref="ds:DigestMethod"/&gt;
- *     &lt;element ref="ds:DigestValue"/&gt;
- *   &lt;/sequence&gt;
- *   &lt;attribute name="Id" type="ID" use="optional"/&gt;
- *   &lt;attribute name="URI" type="anyURI" use="optional"/&gt;
- *   &lt;attribute name="Type" type="anyURI" use="optional"/&gt;
- * &lt;/complexType&gt;
- *
- * &lt;element name="DigestValue" type="ds:DigestValueType"/&gt;
- * &lt;simpleType name="DigestValueType"&gt;
- *   &lt;restriction base="base64Binary"/&gt;
- * &lt;/simpleType&gt;
- * </pre></code>
- *
- * <p>A <code>Reference</code> instance may be created by invoking one of the
- * {@link XMLSignatureFactory#newReference newReference} methods of the
- * {@link XMLSignatureFactory} class; for example:
- *
- * <pre>
- *   XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
- *   Reference ref = factory.newReference
- *     ("http://www.ietf.org/rfc/rfc3275.txt",
- *      factory.newDigestMethod(DigestMethod.SHA1, null));
- * </pre>
- *
- * @author Sean Mullan
- * @author Erwin van der Koogh
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newReference(String, DigestMethod)
- * @see XMLSignatureFactory#newReference(String, DigestMethod, List, String, String)
- */
-public interface Reference extends URIReference, XMLStructure {
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} of {@link Transform}s that are contained in this
-     * <code>Reference</code>.
-     *
-     * @return an unmodifiable list of <code>Transform</code>s
-     *    (may be empty but never <code>null</code>)
-     */
-    List getTransforms();
-
-    /**
-     * Returns the digest method of this <code>Reference</code>.
-     *
-     * @return the digest method
-     */
-    DigestMethod getDigestMethod();
-
-    /**
-     * Returns the optional <code>Id</code> attribute of this
-     * <code>Reference</code>, which permits this reference to be
-     * referenced from elsewhere.
-     *
-     * @return the <code>Id</code> attribute (may be <code>null</code> if not
-     *    specified)
-     */
-    String getId();
-
-    /**
-     * Returns the digest value of this <code>Reference</code>.
-     *
-     * @return the raw digest value, or <code>null</code> if this reference has
-     *    not been digested yet. Each invocation of this method returns a new
-     *    clone to protect against subsequent modification.
-     */
-    byte[] getDigestValue();
-
-    /**
-     * Returns the calculated digest value of this <code>Reference</code>
-     * after a validation operation. This method is useful for debugging if
-     * the reference fails to validate.
-     *
-     * @return the calculated digest value, or <code>null</code> if this
-     *    reference has not been validated yet. Each invocation of this method
-     *    returns a new clone to protect against subsequent modification.
-     */
-    byte[] getCalculatedDigestValue();
-
-    /**
-     * Validates this reference. This method verifies the digest of this
-     * reference.
-     *
-     * <p>This method only validates the reference the first time it is
-     * invoked. On subsequent invocations, it returns a cached result.
-     *
-     * @return <code>true</code> if this reference was validated successfully;
-     *    <code>false</code> otherwise
-     * @param validateContext the validating context
-     * @throws NullPointerException if <code>validateContext</code> is
-     *    <code>null</code>
-     * @throws XMLSignatureException if an unexpected exception occurs while
-     *    validating the reference
-     */
-    boolean validate(XMLValidateContext validateContext)
-        throws XMLSignatureException;
-
-    /**
-     * Returns the dereferenced data, if
-     * <a href="XMLSignContext.html#Supported Properties">reference caching</a>
-     * is enabled. This is the result of dereferencing the URI of this
-     * reference during a validation or generation operation.
-     *
-     * @return the dereferenced data, or <code>null</code> if reference
-     *    caching is not enabled or this reference has not been generated or
-     *    validated
-     */
-    Data getDereferencedData();
-
-    /**
-     * Returns the pre-digested input stream, if
-     * <a href="XMLSignContext.html#Supported Properties">reference caching</a>
-     * is enabled. This is the input to the digest operation during a
-     * validation or signing operation.
-     *
-     * @return an input stream containing the pre-digested input, or
-     *    <code>null</code> if reference caching is not enabled or this
-     *    reference has not been generated or validated
-     */
-    InputStream getDigestInputStream();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureMethod.java b/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureMethod.java
deleted file mode 100755
index 781fa49..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureMethod.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: SignatureMethod.java,v 1.5 2005/05/10 16:03:46 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.AlgorithmMethod;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dsig.spec.SignatureMethodParameterSpec;
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A representation of the XML <code>SignatureMethod</code> element
- * as defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * The XML Schema Definition is defined as:
- * <p>
- * <pre>
- *   &lt;element name="SignatureMethod" type="ds:SignatureMethodType"/&gt;
- *     &lt;complexType name="SignatureMethodType" mixed="true"&gt;
- *       &lt;sequence&gt;
- *         &lt;element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/&gt;
- *         &lt;any namespace="##any" minOccurs="0" maxOccurs="unbounded"/&gt;
- *           &lt;!-- (0,unbounded) elements from (1,1) namespace --&gt;
- *       &lt;/sequence&gt;
- *       &lt;attribute name="Algorithm" type="anyURI" use="required"/&gt;
- *     &lt;/complexType&gt;
- * </pre>
- *
- * A <code>SignatureMethod</code> instance may be created by invoking the
- * {@link XMLSignatureFactory#newSignatureMethod newSignatureMethod} method
- * of the {@link XMLSignatureFactory} class.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newSignatureMethod(String, SignatureMethodParameterSpec)
- */
-public interface SignatureMethod extends XMLStructure, AlgorithmMethod {
-
-    /**
-     * The <a href="http://www.w3.org/2000/09/xmldsig#dsa-sha1">DSAwithSHA1</a>
-     * (DSS) signature method algorithm URI.
-     */
-    static final String DSA_SHA1 =
-        "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
-
-    /**
-     * The <a href="http://www.w3.org/2000/09/xmldsig#rsa-sha1">RSAwithSHA1</a>
-     * (PKCS #1) signature method algorithm URI.
-     */
-    static final String RSA_SHA1 =
-        "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
-
-    /**
-     * The <a href="http://www.w3.org/2000/09/xmldsig#hmac-sha1">HMAC-SHA1</a>
-     * MAC signature method algorithm URI
-     */
-    static final String HMAC_SHA1 =
-        "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
-
-    /**
-     * Returns the algorithm-specific input parameters of this
-     * <code>SignatureMethod</code>.
-     *
-     * <p>The returned parameters can be typecast to a {@link
-     * SignatureMethodParameterSpec} object.
-     *
-     * @return the algorithm-specific input parameters of this
-     *    <code>SignatureMethod</code> (may be <code>null</code> if not
-     *    specified)
-     */
-    AlgorithmParameterSpec getParameterSpec();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureProperties.java b/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureProperties.java
deleted file mode 100755
index 127143e..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureProperties.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: SignatureProperties.java,v 1.4 2005/05/10 16:03:46 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.XMLStructure;
-import java.util.List;
-
-/**
- * A representation of the XML <code>SignatureProperties</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * The XML Schema Definition is defined as:
- * <pre><code>
- *&lt;element name="SignatureProperties" type="ds:SignaturePropertiesType"/&gt;
- *   &lt;complexType name="SignaturePropertiesType"&gt;
- *     &lt;sequence&gt;
- *       &lt;element ref="ds:SignatureProperty" maxOccurs="unbounded"/&gt;
- *     &lt;/sequence&gt;
- *     &lt;attribute name="Id" type="ID" use="optional"/&gt;
- *   &lt;/complexType&gt;
- * </code></pre>
- *
- * A <code>SignatureProperties</code> instance may be created by invoking the
- * {@link XMLSignatureFactory#newSignatureProperties newSignatureProperties}
- * method of the {@link XMLSignatureFactory} class; for example:
- *
- * <pre>
- *   XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
- *   SignatureProperties properties =
- *      factory.newSignatureProperties(props, "signature-properties-1");
- * </pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newSignatureProperties(List, String)
- * @see SignatureProperty
- */
-public interface SignatureProperties extends XMLStructure {
-
-    /**
-     * URI that identifies the <code>SignatureProperties</code> element (this
-     * can be specified as the value of the <code>type</code> parameter of the
-     * {@link Reference} class to identify the referent's type).
-     */
-    final static String TYPE =
-        "http://www.w3.org/2000/09/xmldsig#SignatureProperties";
-
-    /**
-     * Returns the Id of this <code>SignatureProperties</code>.
-     *
-     * @return the Id of this <code>SignatureProperties</code> (or
-     *    <code>null</code> if not specified)
-     */
-    String getId();
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} of one or more {@link SignatureProperty}s that are contained in
-     * this <code>SignatureProperties</code>.
-     *
-     * @return an unmodifiable list of one or more
-     *    <code>SignatureProperty</code>s
-     */
-    List getProperties();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureProperty.java b/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureProperty.java
deleted file mode 100755
index d6c8c8f..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/SignatureProperty.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: SignatureProperty.java,v 1.4 2005/05/10 16:03:46 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.XMLStructure;
-import java.util.List;
-
-/**
- * A representation of the XML <code>SignatureProperty</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * The XML Schema Definition is defined as:
- * <pre><code>
- *&lt;element name="SignatureProperty" type="ds:SignaturePropertyType"/&gt;
- *   &lt;complexType name="SignaturePropertyType" mixed="true"&gt;
- *     &lt;choice maxOccurs="unbounded"&gt;
- *       &lt;any namespace="##other" processContents="lax"/&gt;
- *       &lt;!-- (1,1) elements from (1, unbounded) namespaces --&gt;
- *     &lt;/choice&gt;
- *     &lt;attribute name="Target" type="anyURI" use="required"/&gt;
- *     &lt;attribute name="Id" type="ID" use="optional"/&gt;
- *   &lt;/complexType&gt;
- * </code></pre>
- *
- * A <code>SignatureProperty</code> instance may be created by invoking the
- * {@link XMLSignatureFactory#newSignatureProperty newSignatureProperty}
- * method of the {@link XMLSignatureFactory} class; for example:
- *
- * <pre>
- *   XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
- *   SignatureProperty property = factory.newSignatureProperty
- *      (Collections.singletonList(content), "#Signature-1", "TimeStamp");
- * </pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newSignatureProperty(List, String, String)
- * @see SignatureProperties
- */
-public interface SignatureProperty extends XMLStructure {
-
-    /**
-     * Returns the target URI of this <code>SignatureProperty</code>.
-     *
-     * @return the target URI of this <code>SignatureProperty</code> (never
-     *    <code>null</code>)
-     */
-    String getTarget();
-
-    /**
-     * Returns the Id of this <code>SignatureProperty</code>.
-     *
-     * @return the Id of this <code>SignatureProperty</code> (or
-     *    <code>null</code> if not specified)
-     */
-    String getId();
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} of one or more {@link XMLStructure}s that are contained in
-     * this <code>SignatureProperty</code>. These represent additional
-     * information items concerning the generation of the {@link XMLSignature}
-     * (i.e. date/time stamp or serial numbers of cryptographic hardware used
-     * in signature generation).
-     *
-     * @return an unmodifiable list of one or more <code>XMLStructure</code>s
-     */
-    List getContent();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/SignedInfo.java b/ojluni/src/main/java/javax/xml/crypto/dsig/SignedInfo.java
deleted file mode 100755
index a603906..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/SignedInfo.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: SignedInfo.java,v 1.7 2005/05/10 16:03:47 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.XMLStructure;
-import java.io.InputStream;
-import java.util.List;
-
-/**
- * An representation of the XML <code>SignedInfo</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * The XML Schema Definition is defined as:
- * <pre><code>
- * &lt;element name="SignedInfo" type="ds:SignedInfoType"/&gt;
- * &lt;complexType name="SignedInfoType"&gt;
- *   &lt;sequence&gt;
- *     &lt;element ref="ds:CanonicalizationMethod"/&gt;
- *     &lt;element ref="ds:SignatureMethod"/&gt;
- *     &lt;element ref="ds:Reference" maxOccurs="unbounded"/&gt;
- *   &lt;/sequence&gt;
- *   &lt;attribute name="Id" type="ID" use="optional"/&gt;
- * &lt;/complexType&gt;
- * </code></pre>
- *
- * A <code>SignedInfo</code> instance may be created by invoking one of the
- * {@link XMLSignatureFactory#newSignedInfo newSignedInfo} methods of the
- * {@link XMLSignatureFactory} class.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newSignedInfo(CanonicalizationMethod, SignatureMethod, List)
- * @see XMLSignatureFactory#newSignedInfo(CanonicalizationMethod, SignatureMethod, List, String)
- */
-public interface SignedInfo extends XMLStructure {
-
-    /**
-     * Returns the canonicalization method of this <code>SignedInfo</code>.
-     *
-     * @return the canonicalization method
-     */
-    CanonicalizationMethod getCanonicalizationMethod();
-
-    /**
-     * Returns the signature method of this <code>SignedInfo</code>.
-     *
-     * @return the signature method
-     */
-    SignatureMethod getSignatureMethod();
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList
-     * unmodifiable list} of one or more {@link Reference}s.
-     *
-     * @return an unmodifiable list of one or more {@link Reference}s
-     */
-    List getReferences();
-
-    /**
-     * Returns the optional <code>Id</code> attribute of this
-     * <code>SignedInfo</code>.
-     *
-     * @return the id (may be <code>null</code> if not specified)
-     */
-    String getId();
-
-    /**
-     * Returns the canonicalized signed info bytes after a signing or
-     * validation operation. This method is useful for debugging.
-     *
-     * @return an <code>InputStream</code> containing the canonicalized bytes,
-     *    or <code>null</code> if this <code>SignedInfo</code> has not been
-     *    signed or validated yet
-     */
-    InputStream getCanonicalizedData();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/Transform.java b/ojluni/src/main/java/javax/xml/crypto/dsig/Transform.java
deleted file mode 100755
index 6378bca..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/Transform.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: Transform.java,v 1.5 2005/05/10 16:03:48 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import java.io.OutputStream;
-import java.security.spec.AlgorithmParameterSpec;
-import javax.xml.crypto.AlgorithmMethod;
-import javax.xml.crypto.Data;
-import javax.xml.crypto.OctetStreamData;
-import javax.xml.crypto.XMLCryptoContext;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dsig.spec.TransformParameterSpec;
-
-/**
- * A representation of the XML <code>Transform</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * The XML Schema Definition is defined as:
- *
- * <pre>
- * &lt;element name="Transform" type="ds:TransformType"/&gt;
- *   &lt;complexType name="TransformType" mixed="true"&gt;
- *     &lt;choice minOccurs="0" maxOccurs="unbounded"&gt;
- *       &lt;any namespace="##other" processContents="lax"/&gt;
- *       &lt;!-- (1,1) elements from (0,unbounded) namespaces --&gt;
- *       &lt;element name="XPath" type="string"/&gt;
- *     &lt;/choice&gt;
- *     &lt;attribute name="Algorithm" type="anyURI" use="required"/&gt;
- *   &lt;/complexType&gt;
- * </pre>
- *
- * A <code>Transform</code> instance may be created by invoking the
- * {@link XMLSignatureFactory#newTransform newTransform} method
- * of the {@link XMLSignatureFactory} class.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#newTransform(String, TransformParameterSpec)
- */
-public interface Transform extends XMLStructure, AlgorithmMethod {
-
-    /**
-     * The <a href="http://www.w3.org/2000/09/xmldsig#base64">Base64</a>
-     * transform algorithm URI.
-     */
-    final static String BASE64 = "http://www.w3.org/2000/09/xmldsig#base64";
-
-    /**
-     * The <a href="http://www.w3.org/2000/09/xmldsig#enveloped-signature">
-     * Enveloped Signature</a> transform algorithm URI.
-     */
-    final static String ENVELOPED =
-        "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
-
-    /**
-     * The <a href="http://www.w3.org/TR/1999/REC-xpath-19991116">XPath</a>
-     * transform algorithm URI.
-     */
-    final static String XPATH = "http://www.w3.org/TR/1999/REC-xpath-19991116";
-
-    /**
-     * The <a href="http://www.w3.org/2002/06/xmldsig-filter2">
-     * XPath Filter 2</a> transform algorithm URI.
-     */
-    final static String XPATH2 = "http://www.w3.org/2002/06/xmldsig-filter2";
-
-    /**
-     * The <a href="http://www.w3.org/TR/1999/REC-xslt-19991116">XSLT</a>
-     * transform algorithm URI.
-     */
-    final static String XSLT = "http://www.w3.org/TR/1999/REC-xslt-19991116";
-
-    /**
-     * Returns the algorithm-specific input parameters associated with this
-     * <code>Transform</code>.
-     * <p>
-     * The returned parameters can be typecast to a
-     * {@link TransformParameterSpec} object.
-     *
-     * @return the algorithm-specific input parameters (may be <code>null</code>
-     *    if not specified)
-     */
-    AlgorithmParameterSpec getParameterSpec();
-
-    /**
-     * Transforms the specified data using the underlying transform algorithm.
-     *
-     * @param data the data to be transformed
-     * @param context the <code>XMLCryptoContext</code> containing
-     *    additional context (may be <code>null</code> if not applicable)
-     * @return the transformed data
-     * @throws NullPointerException if <code>data</code> is <code>null</code>
-     * @throws TransformException if an error occurs while executing the
-     *    transform
-     */
-    public abstract Data transform(Data data, XMLCryptoContext context)
-        throws TransformException;
-
-    /**
-     * Transforms the specified data using the underlying transform algorithm.
-     * If the output of this transform is an <code>OctetStreamData</code>, then
-     * this method returns <code>null</code> and the bytes are written to the
-     * specified <code>OutputStream</code>. Otherwise, the
-     * <code>OutputStream</code> is ignored and the method behaves as if
-     * {@link #transform(Data, XMLCryptoContext)} were invoked.
-     *
-     * @param data the data to be transformed
-     * @param context the <code>XMLCryptoContext</code> containing
-     *    additional context (may be <code>null</code> if not applicable)
-     * @param os the <code>OutputStream</code> that should be used to write
-     *    the transformed data to
-     * @return the transformed data (or <code>null</code> if the data was
-     *    written to the <code>OutputStream</code> parameter)
-     * @throws NullPointerException if <code>data</code> or <code>os</code>
-     *    is <code>null</code>
-     * @throws TransformException if an error occurs while executing the
-     *    transform
-     */
-    public abstract Data transform
-        (Data data, XMLCryptoContext context, OutputStream os)
-        throws TransformException;
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/TransformException.java b/ojluni/src/main/java/javax/xml/crypto/dsig/TransformException.java
deleted file mode 100755
index 8c3dfca..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/TransformException.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: TransformException.java,v 1.3 2005/05/10 16:03:48 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-/**
- * Indicates an exceptional condition that occured while executing a
- * transform algorithm.
- *
- * <p>A <code>TransformException</code> can contain a cause: another
- * throwable that caused this <code>TransformException</code> to get thrown.
- *
- * @see Transform#transform
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public class TransformException extends Exception {
-
-    private static final long serialVersionUID = 5082634801360427800L;
-
-    /**
-     * The throwable that caused this exception to get thrown, or null if this
-     * exception was not caused by another throwable or if the causative
-     * throwable is unknown.
-     *
-     * @serial
-     */
-    private Throwable cause;
-
-    /**
-     * Constructs a new <code>TransformException</code> with
-     * <code>null</code> as its detail message.
-     */
-    public TransformException() {
-        super();
-    }
-
-    /**
-     * Constructs a new <code>TransformException</code> with the specified
-     * detail message.
-     *
-     * @param message the detail message
-     */
-    public TransformException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new <code>TransformException</code> with the
-     * specified detail message and cause.
-     * <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public TransformException(String message, Throwable cause) {
-        super(message);
-        this.cause = cause;
-    }
-
-    /**
-     * Constructs a new <code>TransformException</code> with the specified
-     * cause and a detail message of
-     * <code>(cause==null ? null : cause.toString())</code>
-     * (which typically contains the class and detail message of
-     * <code>cause</code>).
-     *
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public TransformException(Throwable cause) {
-        super(cause==null ? null : cause.toString());
-        this.cause = cause;
-    }
-
-    /**
-     * Returns the cause of this <code>TransformException</code> or
-     * <code>null</code> if the cause is nonexistent or unknown.  (The
-     * cause is the throwable that caused this
-     * <code>TransformException</code> to get thrown.)
-     *
-     * @return the cause of this <code>TransformException</code> or
-     *         <code>null</code> if the cause is nonexistent or unknown.
-     */
-    public Throwable getCause() {
-        return cause;
-    }
-
-    /**
-     * Prints this <code>TransformException</code>, its backtrace and
-     * the cause's backtrace to the standard error stream.
-     */
-    public void printStackTrace() {
-        super.printStackTrace();
-        if (cause != null) {
-            cause.printStackTrace();
-        }
-    }
-
-    /**
-     * Prints this <code>TransformException</code>, its backtrace and
-     * the cause's backtrace to the specified print stream.
-     *
-     * @param s <code>PrintStream</code> to use for output
-     */
-    public void printStackTrace(PrintStream s) {
-        super.printStackTrace(s);
-        if (cause != null) {
-            cause.printStackTrace(s);
-        }
-    }
-
-    /**
-     * Prints this <code>TransformException</code>, its backtrace and
-     * the cause's backtrace to the specified print writer.
-     *
-     * @param s <code>PrintWriter</code> to use for output
-     */
-    public void printStackTrace(PrintWriter s) {
-        super.printStackTrace(s);
-        if (cause != null) {
-            cause.printStackTrace(s);
-        }
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/TransformService.java b/ojluni/src/main/java/javax/xml/crypto/dsig/TransformService.java
deleted file mode 100755
index 70f4182..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/TransformService.java
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: TransformService.java,v 1.6.4.1 2005/09/15 12:42:11 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Provider.Service;
-import java.security.Security;
-import java.util.*;
-import javax.xml.crypto.MarshalException;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.XMLCryptoContext;
-import javax.xml.crypto.dsig.spec.TransformParameterSpec;
-
-import sun.security.jca.*;
-import sun.security.jca.GetInstance.Instance;
-
-/**
- * A Service Provider Interface for transform and canonicalization algorithms.
- *
- * <p>Each instance of <code>TransformService</code> supports a specific
- * transform or canonicalization algorithm and XML mechanism type. To create a
- * <code>TransformService</code>, call one of the static
- * {@link #getInstance getInstance} methods, passing in the algorithm URI and
- * XML mechanism type desired, for example:
- *
- * <blockquote><code>
- * TransformService ts = TransformService.getInstance(Transform.XPATH2, "DOM");
- * </code></blockquote>
- *
- * <p><code>TransformService</code> implementations are registered and loaded
- * using the {@link java.security.Provider} mechanism.  Each
- * <code>TransformService</code> service provider implementation should include
- * a <code>MechanismType</code> service attribute that identifies the XML
- * mechanism type that it supports. If the attribute is not specified,
- * "DOM" is assumed. For example, a service provider that supports the
- * XPath Filter 2 Transform and DOM mechanism would be specified in the
- * <code>Provider</code> subclass as:
- * <pre>
- *     put("TransformService." + Transform.XPATH2,
- *         "org.example.XPath2TransformService");
- *     put("TransformService." + Transform.XPATH2 + " MechanismType", "DOM");
- * </pre>
- * <code>TransformService</code> implementations that support the DOM
- * mechanism type must abide by the DOM interoperability requirements defined
- * in the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#DOM Mechanism Requirements">
- * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
- * Service Providers</a> section of the API overview for a list of standard
- * mechanism types.
- * <p>
- * Once a <code>TransformService</code> has been created, it can be used
- * to process <code>Transform</code> or <code>CanonicalizationMethod</code>
- * objects. If the <code>Transform</code> or <code>CanonicalizationMethod</code>
- * exists in XML form (for example, when validating an existing
- * <code>XMLSignature</code>), the {@link #init(XMLStructure, XMLCryptoContext)}
- * method must be first called to initialize the transform and provide document
- * context (even if there are no parameters). Alternatively, if the
- * <code>Transform</code> or <code>CanonicalizationMethod</code> is being
- * created from scratch, the {@link #init(TransformParameterSpec)} method
- * is called to initialize the transform with parameters and the
- * {@link #marshalParams marshalParams} method is called to marshal the
- * parameters to XML and provide the transform with document context. Finally,
- * the {@link #transform transform} method is called to perform the
- * transformation.
- * <p>
- * <b>Concurrent Access</b>
- * <p>The static methods of this class are guaranteed to be thread-safe.
- * Multiple threads may concurrently invoke the static methods defined in this
- * class with no ill effects.
- *
- * <p>However, this is not true for the non-static methods defined by this
- * class. Unless otherwise documented by a specific provider, threads that
- * need to access a single <code>TransformService</code> instance
- * concurrently should synchronize amongst themselves and provide the
- * necessary locking. Multiple threads each manipulating a different
- * <code>TransformService</code> instance need not synchronize.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public abstract class TransformService implements Transform {
-
-    private String algorithm;
-    private String mechanism;
-    private Provider provider;
-
-    /**
-     * Default constructor, for invocation by subclasses.
-     */
-    protected TransformService() {}
-
-    /**
-     * Returns a <code>TransformService</code> that supports the specified
-     * algorithm URI (ex: {@link Transform#XPATH2}) and mechanism type
-     * (ex: DOM).
-     *
-     * <p>This method uses the standard JCA provider lookup mechanism to
-     * locate and instantiate a <code>TransformService</code> implementation
-     * of the desired algorithm and <code>MechanismType</code> service
-     * attribute. It traverses the list of registered security
-     * <code>Provider</code>s, starting with the most preferred
-     * <code>Provider</code>. A new <code>TransformService</code> object
-     * from the first <code>Provider</code> that supports the specified
-     * algorithm and mechanism type is returned.
-     *
-     * <p> Note that the list of registered providers may be retrieved via
-     * the {@link Security#getProviders() Security.getProviders()} method.
-     *
-     * @param algorithm the URI of the algorithm
-     * @param mechanismType the type of the XML processing mechanism and
-     *   representation
-     * @return a new <code>TransformService</code>
-     * @throws NullPointerException if <code>algorithm</code> or
-     *   <code>mechanismType</code> is  <code>null</code>
-     * @throws NoSuchAlgorithmException if no <code>Provider</code> supports a
-     *   <code>TransformService</code> implementation for the specified
-     *   algorithm and mechanism type
-     * @see Provider
-     */
-    public static TransformService getInstance
-        (String algorithm, String mechanismType)
-        throws NoSuchAlgorithmException {
-        if (mechanismType == null || algorithm == null) {
-            throw new NullPointerException();
-        }
-        boolean dom = false;
-        if (mechanismType.equals("DOM")) {
-            dom = true;
-        }
-        List services = GetInstance.getServices("TransformService", algorithm);
-        for (Iterator t = services.iterator(); t.hasNext(); ) {
-            Service s = (Service)t.next();
-            String value = s.getAttribute("MechanismType");
-            if ((value == null && dom) ||
-                (value != null && value.equals(mechanismType))) {
-                Instance instance = GetInstance.getInstance(s, null);
-                TransformService ts = (TransformService) instance.impl;
-                ts.algorithm = algorithm;
-                ts.mechanism = mechanismType;
-                ts.provider = instance.provider;
-                return ts;
-            }
-        }
-        throw new NoSuchAlgorithmException
-            (algorithm + " algorithm and " + mechanismType
-                 + " mechanism not available");
-    }
-
-    /**
-     * Returns a <code>TransformService</code> that supports the specified
-     * algorithm URI (ex: {@link Transform#XPATH2}) and mechanism type
-     * (ex: DOM) as supplied by the specified provider. Note that the specified
-     * <code>Provider</code> object does not have to be registered in the
-     * provider list.
-     *
-     * @param algorithm the URI of the algorithm
-     * @param mechanismType the type of the XML processing mechanism and
-     *   representation
-     * @param provider the <code>Provider</code> object
-     * @return a new <code>TransformService</code>
-     * @throws NullPointerException if <code>provider</code>,
-     *   <code>algorithm</code>, or <code>mechanismType</code> is
-     *   <code>null</code>
-     * @throws NoSuchAlgorithmException if a <code>TransformService</code>
-     *   implementation for the specified algorithm and mechanism type is not
-     *   available from the specified <code>Provider</code> object
-     * @see Provider
-     */
-    public static TransformService getInstance
-        (String algorithm, String mechanismType, Provider provider)
-        throws NoSuchAlgorithmException {
-        if (mechanismType == null || algorithm == null || provider == null) {
-            throw new NullPointerException();
-        }
-
-        boolean dom = false;
-        if (mechanismType.equals("DOM")) {
-            dom = true;
-        }
-        Service s = GetInstance.getService
-            ("TransformService", algorithm, provider);
-        String value = s.getAttribute("MechanismType");
-        if ((value == null && dom) ||
-            (value != null && value.equals(mechanismType))) {
-            Instance instance = GetInstance.getInstance(s, null);
-            TransformService ts = (TransformService) instance.impl;
-            ts.algorithm = algorithm;
-            ts.mechanism = mechanismType;
-            ts.provider = instance.provider;
-            return ts;
-        }
-        throw new NoSuchAlgorithmException
-            (algorithm + " algorithm and " + mechanismType
-                 + " mechanism not available");
-    }
-
-    /**
-     * Returns a <code>TransformService</code> that supports the specified
-     * algorithm URI (ex: {@link Transform#XPATH2}) and mechanism type
-     * (ex: DOM) as supplied by the specified provider. The specified provider
-     * must be registered in the security provider list.
-     *
-     * <p>Note that the list of registered providers may be retrieved via
-     * the {@link Security#getProviders() Security.getProviders()} method.
-     *
-     * @param algorithm the URI of the algorithm
-     * @param mechanismType the type of the XML processing mechanism and
-     *   representation
-     * @param provider the string name of the provider
-     * @return a new <code>TransformService</code>
-     * @throws NoSuchProviderException if the specified provider is not
-     *   registered in the security provider list
-     * @throws NullPointerException if <code>provider</code>,
-     *   <code>mechanismType</code>, or <code>algorithm</code> is
-     *   <code>null</code>
-     * @throws NoSuchAlgorithmException if a <code>TransformService</code>
-     *   implementation for the specified algorithm and mechanism type is not
-     *   available from the specified provider
-     * @see Provider
-     */
-    public static TransformService getInstance
-        (String algorithm, String mechanismType, String provider)
-        throws NoSuchAlgorithmException, NoSuchProviderException {
-        if (mechanismType == null || algorithm == null || provider == null) {
-            throw new NullPointerException();
-        } else if (provider.length() == 0) {
-            throw new NoSuchProviderException();
-        }
-        boolean dom = false;
-        if (mechanismType.equals("DOM")) {
-            dom = true;
-        }
-        Service s = GetInstance.getService
-            ("TransformService", algorithm, provider);
-        String value = s.getAttribute("MechanismType");
-        if ((value == null && dom) ||
-            (value != null && value.equals(mechanismType))) {
-            Instance instance = GetInstance.getInstance(s, null);
-            TransformService ts = (TransformService) instance.impl;
-            ts.algorithm = algorithm;
-            ts.mechanism = mechanismType;
-            ts.provider = instance.provider;
-            return ts;
-        }
-        throw new NoSuchAlgorithmException
-            (algorithm + " algorithm and " + mechanismType
-                 + " mechanism not available");
-    }
-
-    private static class MechanismMapEntry implements Map.Entry {
-        private final String mechanism;
-        private final String algorithm;
-        private final String key;
-        MechanismMapEntry(String algorithm, String mechanism) {
-            this.algorithm = algorithm;
-            this.mechanism = mechanism;
-            this.key = "TransformService." + algorithm + " MechanismType";
-        }
-        public boolean equals(Object o) {
-            if (!(o instanceof Map.Entry)) {
-                return false;
-            }
-            Map.Entry e = (Map.Entry) o;
-            return (getKey()==null ?
-                    e.getKey()==null : getKey().equals(e.getKey())) &&
-                   (getValue()==null ?
-                    e.getValue()==null : getValue().equals(e.getValue()));
-        }
-        public Object getKey() {
-            return key;
-        }
-        public Object getValue() {
-            return mechanism;
-        }
-        public Object setValue(Object value) {
-            throw new UnsupportedOperationException();
-        }
-        public int hashCode() {
-            return (getKey()==null ? 0 : getKey().hashCode()) ^
-                   (getValue()==null ? 0 : getValue().hashCode());
-        }
-    }
-
-    /**
-     * Returns the mechanism type supported by this <code>TransformService</code>.
-     *
-     * @return the mechanism type
-     */
-    public final String getMechanismType() {
-        return mechanism;
-    }
-
-    /**
-     * Returns the URI of the algorithm supported by this
-     * <code>TransformService</code>.
-     *
-     * @return the algorithm URI
-     */
-    public final String getAlgorithm() {
-        return algorithm;
-    }
-
-    /**
-     * Returns the provider of this <code>TransformService</code>.
-     *
-     * @return the provider
-     */
-    public final Provider getProvider() {
-        return provider;
-    }
-
-    /**
-     * Initializes this <code>TransformService</code> with the specified
-     * parameters.
-     *
-     * <p>If the parameters exist in XML form, the
-     * {@link #init(XMLStructure, XMLCryptoContext)} method should be used to
-     * initialize the <code>TransformService</code>.
-     *
-     * @param params the algorithm parameters (may be <code>null</code> if
-     *   not required or optional)
-     * @throws InvalidAlgorithmParameterException if the specified parameters
-     *   are invalid for this algorithm
-     */
-    public abstract void init(TransformParameterSpec params)
-        throws InvalidAlgorithmParameterException;
-
-    /**
-     * Marshals the algorithm-specific parameters. If there are no parameters
-     * to be marshalled, this method returns without throwing an exception.
-     *
-     * @param parent a mechanism-specific structure containing the parent
-     *    node that the marshalled parameters should be appended to
-     * @param context the <code>XMLCryptoContext</code> containing
-     *    additional context (may be <code>null</code> if not applicable)
-     * @throws ClassCastException if the type of <code>parent</code> or
-     *    <code>context</code> is not compatible with this
-     *    <code>TransformService</code>
-     * @throws NullPointerException if <code>parent</code> is <code>null</code>
-     * @throws MarshalException if the parameters cannot be marshalled
-     */
-    public abstract void marshalParams
-        (XMLStructure parent, XMLCryptoContext context)
-        throws MarshalException;
-
-    /**
-     * Initializes this <code>TransformService</code> with the specified
-     * parameters and document context.
-     *
-     * @param parent a mechanism-specific structure containing the parent
-     *    structure
-     * @param context the <code>XMLCryptoContext</code> containing
-     *    additional context (may be <code>null</code> if not applicable)
-     * @throws ClassCastException if the type of <code>parent</code> or
-     *    <code>context</code> is not compatible with this
-     *    <code>TransformService</code>
-     * @throws NullPointerException if <code>parent</code> is <code>null</code>
-     * @throws InvalidAlgorithmParameterException if the specified parameters
-     *   are invalid for this algorithm
-     */
-    public abstract void init(XMLStructure parent, XMLCryptoContext context)
-        throws InvalidAlgorithmParameterException;
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLObject.java b/ojluni/src/main/java/javax/xml/crypto/dsig/XMLObject.java
deleted file mode 100755
index 88db693..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLObject.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * ===========================================================================
- *
- * (C) Copyright IBM Corp. 2003 All Rights Reserved.
- *
- * ===========================================================================
- */
-/*
- * $Id: XMLObject.java,v 1.5 2005/05/10 16:03:48 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import java.util.List;
-import javax.xml.crypto.XMLStructure;
-
-/**
- * A representation of the XML <code>Object</code> element as defined in
- * the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * An <code>XMLObject</code> may contain any data and may include optional
- * MIME type, ID, and encoding attributes. The XML Schema Definition is
- * defined as:
- *
- * <pre><code>
- * &lt;element name="Object" type="ds:ObjectType"/&gt;
- * &lt;complexType name="ObjectType" mixed="true"&gt;
- *   &lt;sequence minOccurs="0" maxOccurs="unbounded"&gt;
- *     &lt;any namespace="##any" processContents="lax"/&gt;
- *   &lt;/sequence&gt;
- *   &lt;attribute name="Id" type="ID" use="optional"/&gt;
- *   &lt;attribute name="MimeType" type="string" use="optional"/&gt;
- *   &lt;attribute name="Encoding" type="anyURI" use="optional"/&gt;
- * &lt;/complexType&gt;
- * </code></pre>
- *
- * A <code>XMLObject</code> instance may be created by invoking the
- * {@link XMLSignatureFactory#newXMLObject newXMLObject} method of the
- * {@link XMLSignatureFactory} class; for example:
- *
- * <pre>
- *   XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
- *   List content = Collections.singletonList(fac.newManifest(references)));
- *   XMLObject object = factory.newXMLObject(content, "object-1", null, null);
- * </pre>
- *
- * <p>Note that this class is named <code>XMLObject</code> rather than
- * <code>Object</code> to avoid naming clashes with the existing
- * {@link java.lang.Object java.lang.Object} class.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @author Joyce L. Leung
- * @since 1.6
- * @see XMLSignatureFactory#newXMLObject(List, String, String, String)
- */
-public interface XMLObject extends XMLStructure {
-
-    /**
-     * URI that identifies the <code>Object</code> element (this can be
-     * specified as the value of the <code>type</code> parameter of the
-     * {@link Reference} class to identify the referent's type).
-     */
-    final static String TYPE = "http://www.w3.org/2000/09/xmldsig#Object";
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} of {@link XMLStructure}s contained in this <code>XMLObject</code>,
-     * which represent elements from any namespace.
-     *
-     *<p>If there is a public subclass representing the type of
-     * <code>XMLStructure</code>, it is returned as an instance of that class
-     * (ex: a <code>SignatureProperties</code> element would be returned
-     * as an instance of {@link javax.xml.crypto.dsig.SignatureProperties}).
-     *
-     * @return an unmodifiable list of <code>XMLStructure</code>s (may be empty
-     *    but never <code>null</code>)
-     */
-    List getContent();
-
-    /**
-     * Returns the Id of this <code>XMLObject</code>.
-     *
-     * @return the Id (or <code>null</code> if not specified)
-     */
-    String getId();
-
-    /**
-     * Returns the mime type of this <code>XMLObject</code>. The
-     * mime type is an optional attribute which describes the data within this
-     * <code>XMLObject</code> (independent of its encoding).
-     *
-     * @return the mime type (or <code>null</code> if not specified)
-     */
-    String getMimeType();
-
-    /**
-     * Returns the encoding URI of this <code>XMLObject</code>. The encoding
-     * URI identifies the method by which the object is encoded.
-     *
-     * @return the encoding URI (or <code>null</code> if not specified)
-     */
-    String getEncoding();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignContext.java b/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignContext.java
deleted file mode 100755
index 8d98e1f..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignContext.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XMLSignContext.java,v 1.8 2005/05/10 16:03:48 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.KeySelector;
-import javax.xml.crypto.XMLCryptoContext;
-
-/**
- * Contains context information for generating XML Signatures. This interface
- * is primarily intended for type-safety.
- *
- * <p>Note that <code>XMLSignContext</code> instances can contain
- * information and state specific to the XML signature structure it is
- * used with. The results are unpredictable if an
- * <code>XMLSignContext</code> is used with different signature structures
- * (for example, you should not use the same <code>XMLSignContext</code>
- * instance to sign two different {@link XMLSignature} objects).
- * <p>
- * <b><a name="Supported Properties"></a>Supported Properties</b>
- * <p>The following properties can be set using the
- * {@link #setProperty setProperty} method.
- * <ul>
- *   <li><code>javax.xml.crypto.dsig.cacheReference</code>: value must be a
- *      {@link Boolean}. This property controls whether or not the digested
- *      {@link Reference} objects will cache the dereferenced content and
- *      pre-digested input for subsequent retrieval via the
- *      {@link Reference#getDereferencedData Reference.getDereferencedData} and
- *      {@link Reference#getDigestInputStream Reference.getDigestInputStream}
- *      methods. The default value if not specified is
- *      <code>Boolean.FALSE</code>.
- * </ul>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignature#sign(XMLSignContext)
- */
-public interface XMLSignContext extends XMLCryptoContext {}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignature.java b/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignature.java
deleted file mode 100755
index 829a41a..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignature.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * ===========================================================================
- *
- * (C) Copyright IBM Corp. 2003 All Rights Reserved.
- *
- * ===========================================================================
- */
-/*
- * $Id: XMLSignature.java,v 1.10 2005/05/10 16:03:48 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.KeySelector;
-import javax.xml.crypto.KeySelectorResult;
-import javax.xml.crypto.MarshalException;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import java.security.Signature;
-import java.util.List;
-
-/**
- * A representation of the XML <code>Signature</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * This class contains methods for signing and validating XML signatures
- * with behavior as defined by the W3C specification. The XML Schema Definition
- * is defined as:
- * <pre><code>
- * &lt;element name="Signature" type="ds:SignatureType"/&gt;
- * &lt;complexType name="SignatureType"&gt;
- *    &lt;sequence&gt;
- *      &lt;element ref="ds:SignedInfo"/&gt;
- *      &lt;element ref="ds:SignatureValue"/&gt;
- *      &lt;element ref="ds:KeyInfo" minOccurs="0"/&gt;
- *      &lt;element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/&gt;
- *    &lt;/sequence&gt;
- *    &lt;attribute name="Id" type="ID" use="optional"/&gt;
- * &lt;/complexType&gt;
- * </code></pre>
- * <p>
- * An <code>XMLSignature</code> instance may be created by invoking one of the
- * {@link XMLSignatureFactory#newXMLSignature newXMLSignature} methods of the
- * {@link XMLSignatureFactory} class.
- *
- * <p>If the contents of the underlying document containing the
- * <code>XMLSignature</code> are subsequently modified, the behavior is
- * undefined.
- *
- * <p>Note that this class is named <code>XMLSignature</code> rather than
- * <code>Signature</code> to avoid naming clashes with the existing
- * {@link Signature java.security.Signature} class.
- *
- * @see XMLSignatureFactory#newXMLSignature(SignedInfo, KeyInfo)
- * @see XMLSignatureFactory#newXMLSignature(SignedInfo, KeyInfo, List, String, String)
- * @author Joyce L. Leung
- * @author Sean Mullan
- * @author Erwin van der Koogh
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public interface XMLSignature extends XMLStructure {
-
-    /**
-     * The XML Namespace URI of the W3C Recommendation for XML-Signature
-     * Syntax and Processing.
-     */
-    final static String XMLNS = "http://www.w3.org/2000/09/xmldsig#";
-
-    /**
-     * Validates the signature according to the
-     * <a href="http://www.w3.org/TR/xmldsig-core/#sec-CoreValidation">
-     * core validation processing rules</a>. This method validates the
-     * signature using the existing state, it does not unmarshal and
-     * reinitialize the contents of the <code>XMLSignature</code> using the
-     * location information specified in the context.
-     *
-     * <p>This method only validates the signature the first time it is
-     * invoked. On subsequent invocations, it returns a cached result.
-     *
-     * @param validateContext the validating context
-     * @return <code>true</code> if the signature passed core validation,
-     *    otherwise <code>false</code>
-     * @throws ClassCastException if the type of <code>validateContext</code>
-     *    is not compatible with this <code>XMLSignature</code>
-     * @throws NullPointerException if <code>validateContext</code> is
-     *    <code>null</code>
-     * @throws XMLSignatureException if an unexpected error occurs during
-     *    validation that prevented the validation operation from completing
-     */
-    boolean validate(XMLValidateContext validateContext)
-        throws XMLSignatureException;
-
-    /**
-     * Returns the key info of this <code>XMLSignature</code>.
-     *
-     * @return the key info (may be <code>null</code> if not specified)
-     */
-    KeyInfo getKeyInfo();
-
-    /**
-     * Returns the signed info of this <code>XMLSignature</code>.
-     *
-     * @return the signed info (never <code>null</code>)
-     */
-    SignedInfo getSignedInfo();
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} of {@link XMLObject}s contained in this <code>XMLSignature</code>.
-     *
-     * @return an unmodifiable list of <code>XMLObject</code>s (may be empty
-     *    but never <code>null</code>)
-     */
-    List getObjects();
-
-    /**
-     * Returns the optional Id of this <code>XMLSignature</code>.
-     *
-     * @return the Id (may be <code>null</code> if not specified)
-     */
-    String getId();
-
-    /**
-     * Returns the signature value of this <code>XMLSignature</code>.
-     *
-     * @return the signature value
-     */
-    SignatureValue getSignatureValue();
-
-    /**
-     * Signs this <code>XMLSignature</code>.
-     *
-     * <p>If this method throws an exception, this <code>XMLSignature</code> and
-     * the <code>signContext</code> parameter will be left in the state that
-     * it was in prior to the invocation.
-     *
-     * @param signContext the signing context
-     * @throws ClassCastException if the type of <code>signContext</code> is
-     *    not compatible with this <code>XMLSignature</code>
-     * @throws NullPointerException if <code>signContext</code> is
-     *    <code>null</code>
-     * @throws MarshalException if an exception occurs while marshalling
-     * @throws XMLSignatureException if an unexpected exception occurs while
-     *    generating the signature
-     */
-    void sign(XMLSignContext signContext) throws MarshalException,
-        XMLSignatureException;
-
-    /**
-     * Returns the result of the {@link KeySelector}, if specified, after
-     * this <code>XMLSignature</code> has been signed or validated.
-     *
-     * @return the key selector result, or <code>null</code> if a key
-     *    selector has not been specified or this <code>XMLSignature</code>
-     *    has not been signed or validated
-     */
-    KeySelectorResult getKeySelectorResult();
-
-    /**
-     * A representation of the XML <code>SignatureValue</code> element as
-     * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
-     * W3C Recommendation for XML-Signature Syntax and Processing</a>.
-     * The XML Schema Definition is defined as:
-     * <p>
-     * <pre>
-     *   &lt;element name="SignatureValue" type="ds:SignatureValueType"/&gt;
-     *     &lt;complexType name="SignatureValueType"&gt;
-     *       &lt;simpleContent&gt;
-     *         &lt;extension base="base64Binary"&gt;
-     *           &lt;attribute name="Id" type="ID" use="optional"/&gt;
-     *         &lt;/extension&gt;
-     *       &lt;/simpleContent&gt;
-     *     &lt;/complexType&gt;
-     * </pre>
-     *
-     * @author Sean Mullan
-     * @author JSR 105 Expert Group
-     */
-    public interface SignatureValue extends XMLStructure {
-        /**
-         * Returns the optional <code>Id</code> attribute of this
-         * <code>SignatureValue</code>, which permits this element to be
-         * referenced from elsewhere.
-         *
-         * @return the <code>Id</code> attribute (may be <code>null</code> if
-         *    not specified)
-         */
-        String getId();
-
-        /**
-         * Returns the signature value of this <code>SignatureValue</code>.
-         *
-         * @return the signature value (may be <code>null</code> if the
-         *    <code>XMLSignature</code> has not been signed yet). Each
-         *    invocation of this method returns a new clone of the array to
-         *    prevent subsequent modification.
-         */
-        byte[] getValue();
-
-        /**
-         * Validates the signature value. This method performs a
-         * cryptographic validation of the signature calculated over the
-         * <code>SignedInfo</code> of the <code>XMLSignature</code>.
-         *
-         * <p>This method only validates the signature the first
-         * time it is invoked. On subsequent invocations, it returns a cached
-         * result.
-         *
-         * @return <code>true</code> if the signature was
-         *    validated successfully; <code>false</code> otherwise
-         * @param validateContext the validating context
-         * @throws NullPointerException if <code>validateContext</code> is
-         *    <code>null</code>
-         * @throws XMLSignatureException if an unexpected exception occurs while
-         *    validating the signature
-         */
-        boolean validate(XMLValidateContext validateContext)
-            throws XMLSignatureException;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignatureException.java b/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignatureException.java
deleted file mode 100755
index bd14690..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignatureException.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XMLSignatureException.java,v 1.5 2005/05/10 16:03:48 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-/**
- * Indicates an exceptional condition that occured during the XML
- * signature generation or validation process.
- *
- * <p>An <code>XMLSignatureException</code> can contain a cause: another
- * throwable that caused this <code>XMLSignatureException</code> to get thrown.
- *
- * @since 1.6
- */
-public class XMLSignatureException extends Exception {
-
-    private static final long serialVersionUID = -3438102491013869995L;
-
-    /**
-     * The throwable that caused this exception to get thrown, or null if this
-     * exception was not caused by another throwable or if the causative
-     * throwable is unknown.
-     *
-     * @serial
-     */
-    private Throwable cause;
-
-    /**
-     * Constructs a new <code>XMLSignatureException</code> with
-     * <code>null</code> as its detail message.
-     */
-    public XMLSignatureException() {
-        super();
-    }
-
-    /**
-     * Constructs a new <code>XMLSignatureException</code> with the specified
-     * detail message.
-     *
-     * @param message the detail message
-     */
-    public XMLSignatureException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new <code>XMLSignatureException</code> with the
-     * specified detail message and cause.
-     * <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public XMLSignatureException(String message, Throwable cause) {
-        super(message);
-        this.cause = cause;
-    }
-
-    /**
-     * Constructs a new <code>XMLSignatureException</code> with the specified
-     * cause and a detail message of
-     * <code>(cause==null ? null : cause.toString())</code>
-     * (which typically contains the class and detail message of
-     * <code>cause</code>).
-     *
-     * @param cause the cause (A <tt>null</tt> value is permitted, and
-     *        indicates that the cause is nonexistent or unknown.)
-     */
-    public XMLSignatureException(Throwable cause) {
-        super(cause==null ? null : cause.toString());
-        this.cause = cause;
-    }
-
-    /**
-     * Returns the cause of this <code>XMLSignatureException</code> or
-     * <code>null</code> if the cause is nonexistent or unknown.  (The
-     * cause is the throwable that caused this
-     * <code>XMLSignatureException</code> to get thrown.)
-     *
-     * @return the cause of this <code>XMLSignatureException</code> or
-     *         <code>null</code> if the cause is nonexistent or unknown.
-     */
-    public Throwable getCause() {
-        return cause;
-    }
-
-    /**
-     * Prints this <code>XMLSignatureException</code>, its backtrace and
-     * the cause's backtrace to the standard error stream.
-     */
-    public void printStackTrace() {
-        super.printStackTrace();
-        if (cause != null) {
-            cause.printStackTrace();
-        }
-    }
-
-    /**
-     * Prints this <code>XMLSignatureException</code>, its backtrace and
-     * the cause's backtrace to the specified print stream.
-     *
-     * @param s <code>PrintStream</code> to use for output
-     */
-    public void printStackTrace(PrintStream s) {
-        super.printStackTrace(s);
-        if (cause != null) {
-            cause.printStackTrace(s);
-        }
-    }
-
-    /**
-     * Prints this <code>XMLSignatureException</code>, its backtrace and
-     * the cause's backtrace to the specified print writer.
-     *
-     * @param s <code>PrintWriter</code> to use for output
-     */
-    public void printStackTrace(PrintWriter s) {
-        super.printStackTrace(s);
-        if (cause != null) {
-            cause.printStackTrace(s);
-        }
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignatureFactory.java b/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignatureFactory.java
deleted file mode 100755
index 3d3426b..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLSignatureFactory.java
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XMLSignatureFactory.java,v 1.14 2005/09/15 14:29:01 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.Data;
-import javax.xml.crypto.MarshalException;
-import javax.xml.crypto.NoSuchMechanismException;
-import javax.xml.crypto.URIDereferencer;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dom.DOMStructure;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
-import javax.xml.crypto.dsig.spec.*;
-import javax.xml.crypto.dsig.dom.DOMValidateContext;
-import javax.xml.crypto.dsig.dom.DOMSignContext;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.Security;
-import java.util.List;
-
-import sun.security.jca.*;
-import sun.security.jca.GetInstance.Instance;
-
-/**
- * A factory for creating {@link XMLSignature} objects from scratch or
- * for unmarshalling an <code>XMLSignature</code> object from a corresponding
- * XML representation.
- *
- * <h2>XMLSignatureFactory Type</h2>
- *
- * <p>Each instance of <code>XMLSignatureFactory</code> supports a specific
- * XML mechanism type. To create an <code>XMLSignatureFactory</code>, call one
- * of the static {@link #getInstance getInstance} methods, passing in the XML
- * mechanism type desired, for example:
- *
- * <blockquote><code>
- * XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
- * </code></blockquote>
- *
- * <p>The objects that this factory produces will be based
- * on DOM and abide by the DOM interoperability requirements as defined in the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#DOM Mechanism Requirements">
- * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
- * Service Providers</a> section of the API overview for a list of standard
- * mechanism types.
- *
- * <p><code>XMLSignatureFactory</code> implementations are registered and loaded
- * using the {@link java.security.Provider} mechanism.
- * For example, a service provider that supports the
- * DOM mechanism would be specified in the <code>Provider</code> subclass as:
- * <pre>
- *     put("XMLSignatureFactory.DOM", "org.example.DOMXMLSignatureFactory");
- * </pre>
- *
- * <p>An implementation MUST minimally support the default mechanism type: DOM.
- *
- * <p>Note that a caller must use the same <code>XMLSignatureFactory</code>
- * instance to create the <code>XMLStructure</code>s of a particular
- * <code>XMLSignature</code> that is to be generated. The behavior is
- * undefined if <code>XMLStructure</code>s from different providers or
- * different mechanism types are used together.
- *
- * <p>Also, the <code>XMLStructure</code>s that are created by this factory
- * may contain state specific to the <code>XMLSignature</code> and are not
- * intended to be reusable.
- *
- * <h2>Creating XMLSignatures from scratch</h2>
- *
- * <p>Once the <code>XMLSignatureFactory</code> has been created, objects
- * can be instantiated by calling the appropriate method. For example, a
- * {@link Reference} instance may be created by invoking one of the
- * {@link #newReference newReference} methods.
- *
- * <h2>Unmarshalling XMLSignatures from XML</h2>
- *
- * <p>Alternatively, an <code>XMLSignature</code> may be created from an
- * existing XML representation by invoking the {@link #unmarshalXMLSignature
- * unmarshalXMLSignature} method and passing it a mechanism-specific
- * {@link XMLValidateContext} instance containing the XML content:
- *
- * <pre>
- * DOMValidateContext context = new DOMValidateContext(key, signatureElement);
- * XMLSignature signature = factory.unmarshalXMLSignature(context);
- * </pre>
- *
- * Each <code>XMLSignatureFactory</code> must support the required
- * <code>XMLValidateContext</code> types for that factory type, but may support
- * others. A DOM <code>XMLSignatureFactory</code> must support {@link
- * DOMValidateContext} objects.
- *
- * <h2>Signing and marshalling XMLSignatures to XML</h2>
- *
- * Each <code>XMLSignature</code> created by the factory can also be
- * marshalled to an XML representation and signed, by invoking the
- * {@link XMLSignature#sign sign} method of the
- * {@link XMLSignature} object and passing it a mechanism-specific
- * {@link XMLSignContext} object containing the signing key and
- * marshalling parameters (see {@link DOMSignContext}).
- * For example:
- *
- * <pre>
- *    DOMSignContext context = new DOMSignContext(privateKey, document);
- *    signature.sign(context);
- * </pre>
- *
- * <b>Concurrent Access</b>
- * <p>The static methods of this class are guaranteed to be thread-safe.
- * Multiple threads may concurrently invoke the static methods defined in this
- * class with no ill effects.
- *
- * <p>However, this is not true for the non-static methods defined by this
- * class. Unless otherwise documented by a specific provider, threads that
- * need to access a single <code>XMLSignatureFactory</code> instance
- * concurrently should synchronize amongst themselves and provide the
- * necessary locking. Multiple threads each manipulating a different
- * <code>XMLSignatureFactory</code> instance need not synchronize.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public abstract class XMLSignatureFactory {
-
-    private String mechanismType;
-    private Provider provider;
-
-    /**
-     * Default constructor, for invocation by subclasses.
-     */
-    protected XMLSignatureFactory() {}
-
-    /**
-     * Returns an <code>XMLSignatureFactory</code> that supports the
-     * specified XML processing mechanism and representation type (ex: "DOM").
-     *
-     * <p>This method uses the standard JCA provider lookup mechanism to
-     * locate and instantiate an <code>XMLSignatureFactory</code>
-     * implementation of the desired mechanism type. It traverses the list of
-     * registered security <code>Provider</code>s, starting with the most
-     * preferred <code>Provider</code>.  A new <code>XMLSignatureFactory</code>
-     * object from the first <code>Provider</code> that supports the specified
-     * mechanism is returned.
-     *
-     * <p>Note that the list of registered providers may be retrieved via
-     * the {@link Security#getProviders() Security.getProviders()} method.
-     *
-     * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the <a
-     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
-     *    Service Providers</a> section of the API overview for a list of
-     *    standard mechanism types.
-     * @return a new <code>XMLSignatureFactory</code>
-     * @throws NullPointerException if <code>mechanismType</code> is
-     *    <code>null</code>
-     * @throws NoSuchMechanismException if no <code>Provider</code> supports an
-     *    <code>XMLSignatureFactory</code> implementation for the specified
-     *    mechanism
-     * @see Provider
-     */
-    public static XMLSignatureFactory getInstance(String mechanismType) {
-        if (mechanismType == null) {
-            throw new NullPointerException("mechanismType cannot be null");
-        }
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("XMLSignatureFactory", null, mechanismType);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
-        }
-        XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
-    }
-
-    /**
-     * Returns an <code>XMLSignatureFactory</code> that supports the
-     * requested XML processing mechanism and representation type (ex: "DOM"),
-     * as supplied by the specified provider. Note that the specified
-     * <code>Provider</code> object does not have to be registered in the
-     * provider list.
-     *
-     * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the <a
-     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
-     *    Service Providers</a> section of the API overview for a list of
-     *    standard mechanism types.
-     * @param provider the <code>Provider</code> object
-     * @return a new <code>XMLSignatureFactory</code>
-     * @throws NullPointerException if <code>provider</code> or
-     *    <code>mechanismType</code> is <code>null</code>
-     * @throws NoSuchMechanismException if an <code>XMLSignatureFactory</code>
-     *   implementation for the specified mechanism is not available
-     *   from the specified <code>Provider</code> object
-     * @see Provider
-     */
-    public static XMLSignatureFactory getInstance(String mechanismType,
-        Provider provider) {
-        if (mechanismType == null) {
-            throw new NullPointerException("mechanismType cannot be null");
-        } else if (provider == null) {
-            throw new NullPointerException("provider cannot be null");
-        }
-
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("XMLSignatureFactory", null, mechanismType, provider);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
-        }
-        XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
-    }
-
-    /**
-     * Returns an <code>XMLSignatureFactory</code> that supports the
-     * requested XML processing mechanism and representation type (ex: "DOM"),
-     * as supplied by the specified provider. The specified provider must be
-     * registered in the security provider list.
-     *
-     * <p>Note that the list of registered providers may be retrieved via
-     * the {@link Security#getProviders() Security.getProviders()} method.
-     *
-     * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the <a
-     *    href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
-     *    Service Providers</a> section of the API overview for a list of
-     *    standard mechanism types.
-     * @param provider the string name of the provider
-     * @return a new <code>XMLSignatureFactory</code>
-     * @throws NoSuchProviderException if the specified provider is not
-     *    registered in the security provider list
-     * @throws NullPointerException if <code>provider</code> or
-     *    <code>mechanismType</code> is <code>null</code>
-     * @throws NoSuchMechanismException if an <code>XMLSignatureFactory</code>
-     *    implementation for the specified mechanism is not
-     *    available from the specified provider
-     * @see Provider
-     */
-    public static XMLSignatureFactory getInstance(String mechanismType,
-        String provider) throws NoSuchProviderException {
-        if (mechanismType == null) {
-            throw new NullPointerException("mechanismType cannot be null");
-        } else if (provider == null) {
-            throw new NullPointerException("provider cannot be null");
-        } else if (provider.length() == 0) {
-            throw new NoSuchProviderException();
-        }
-
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("XMLSignatureFactory", null, mechanismType, provider);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
-        }
-        XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
-    }
-
-    /**
-     * Returns an <code>XMLSignatureFactory</code> that supports the
-     * default XML processing mechanism and representation type ("DOM").
-     *
-     * <p>This method uses the standard JCA provider lookup mechanism to
-     * locate and instantiate an <code>XMLSignatureFactory</code>
-     * implementation of the default mechanism type. It traverses the list of
-     * registered security <code>Provider</code>s, starting with the most
-     * preferred <code>Provider</code>.  A new <code>XMLSignatureFactory</code>
-     * object from the first <code>Provider</code> that supports the DOM
-     * mechanism is returned.
-     *
-     * <p>Note that the list of registered providers may be retrieved via
-     * the {@link Security#getProviders() Security.getProviders()} method.
-     *
-     * @return a new <code>XMLSignatureFactory</code>
-     * @throws NoSuchMechanismException if no <code>Provider</code> supports an
-     *    <code>XMLSignatureFactory</code> implementation for the DOM
-     *    mechanism
-     * @see Provider
-     */
-    public static XMLSignatureFactory getInstance() {
-        return getInstance("DOM");
-    }
-
-    /**
-     * Returns the type of the XML processing mechanism and representation
-     * supported by this <code>XMLSignatureFactory</code> (ex: "DOM").
-     *
-     * @return the XML processing mechanism type supported by this
-     *    <code>XMLSignatureFactory</code>
-     */
-    public final String getMechanismType() {
-        return mechanismType;
-    }
-
-    /**
-     * Returns the provider of this <code>XMLSignatureFactory</code>.
-     *
-     * @return the provider of this <code>XMLSignatureFactory</code>
-     */
-    public final Provider getProvider() {
-        return provider;
-    }
-
-    /**
-     * Creates an <code>XMLSignature</code> and initializes it with the contents
-     * of the specified <code>SignedInfo</code> and <code>KeyInfo</code>
-     * objects.
-     *
-     * @param si the signed info
-     * @param ki the key info (may be <code>null</code>)
-     * @return an <code>XMLSignature</code>
-     * @throws NullPointerException if <code>si</code> is <code>null</code>
-     */
-    public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki);
-
-    /**
-     * Creates an <code>XMLSignature</code> and initializes it with the
-     * specified parameters.
-     *
-     * @param si the signed info
-     * @param ki the key info (may be <code>null</code>)
-     * @param objects a list of {@link XMLObject}s (may be empty or
-     *    <code>null</code>)
-     * @param id the Id (may be <code>null</code>)
-     * @param signatureValueId the SignatureValue Id (may be <code>null</code>)
-     * @return an <code>XMLSignature</code>
-     * @throws NullPointerException if <code>si</code> is <code>null</code>
-     * @throws ClassCastException if any of the <code>objects</code> are not of
-     *    type <code>XMLObject</code>
-     */
-    public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki,
-        List objects, String id, String signatureValueId);
-
-    /**
-     * Creates a <code>Reference</code> with the specified URI and digest
-     * method.
-     *
-     * @param uri the reference URI (may be <code>null</code>)
-     * @param dm the digest method
-     * @return a <code>Reference</code>
-     * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
-     *    compliant
-     * @throws NullPointerException if <code>dm</code> is <code>null</code>
-     */
-    public abstract Reference newReference(String uri, DigestMethod dm);
-
-    /**
-     * Creates a <code>Reference</code> with the specified parameters.
-     *
-     * @param uri the reference URI (may be <code>null</code>)
-     * @param dm the digest method
-     * @param transforms a list of {@link Transform}s. The list is defensively
-     *    copied to protect against subsequent modification. May be
-     *    <code>null</code> or empty.
-     * @param type the reference type, as a URI (may be <code>null</code>)
-     * @param id the reference ID (may be <code>null</code>)
-     * @return a <code>Reference</code>
-     * @throws ClassCastException if any of the <code>transforms</code> are
-     *    not of type <code>Transform</code>
-     * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
-     *    compliant
-     * @throws NullPointerException if <code>dm</code> is <code>null</code>
-     */
-    public abstract Reference newReference(String uri, DigestMethod dm,
-        List transforms, String type, String id);
-
-    /**
-     * Creates a <code>Reference</code> with the specified parameters and
-     * pre-calculated digest value.
-     *
-     * <p>This method is useful when the digest value of a
-     * <code>Reference</code> has been previously computed. See for example,
-     * the
-     * <a href="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=dss">
-     * OASIS-DSS (Digital Signature Services)</a> specification.
-     *
-     * @param uri the reference URI (may be <code>null</code>)
-     * @param dm the digest method
-     * @param transforms a list of {@link Transform}s. The list is defensively
-     *    copied to protect against subsequent modification. May be
-     *    <code>null</code> or empty.
-     * @param type the reference type, as a URI (may be <code>null</code>)
-     * @param id the reference ID (may be <code>null</code>)
-     * @param digestValue the digest value. The array is cloned to protect
-     *    against subsequent modification.
-     * @return a <code>Reference</code>
-     * @throws ClassCastException if any of the <code>transforms</code> are
-     *    not of type <code>Transform</code>
-     * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
-     *    compliant
-     * @throws NullPointerException if <code>dm</code> or
-     *    <code>digestValue</code> is <code>null</code>
-     */
-    public abstract Reference newReference(String uri, DigestMethod dm,
-        List transforms, String type, String id, byte[] digestValue);
-
-    /**
-     * Creates a <code>Reference</code> with the specified parameters.
-     *
-     * <p>This method is useful when a list of transforms have already been
-     * applied to the <code>Reference</code>. See for example,
-     * the
-     * <a href="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=dss">
-     * OASIS-DSS (Digital Signature Services)</a> specification.
-     *
-     * <p>When an <code>XMLSignature</code> containing this reference is
-     * generated, the specified <code>transforms</code> (if non-null) are
-     * applied to the specified <code>result</code>. The
-     * <code>Transforms</code> element of the resulting <code>Reference</code>
-     * element is set to the concatenation of the
-     * <code>appliedTransforms</code> and <code>transforms</code>.
-     *
-     * @param uri the reference URI (may be <code>null</code>)
-     * @param dm the digest method
-     * @param appliedTransforms a list of {@link Transform}s that have
-     *    already been applied. The list is defensively
-     *    copied to protect against subsequent modification. The list must
-     *    contain at least one entry.
-     * @param result the result of processing the sequence of
-     *    <code>appliedTransforms</code>
-     * @param transforms a list of {@link Transform}s that are to be applied
-     *    when generating the signature. The list is defensively copied to
-     *    protect against subsequent modification. May be <code>null</code>
-     *    or empty.
-     * @param type the reference type, as a URI (may be <code>null</code>)
-     * @param id the reference ID (may be <code>null</code>)
-     * @return a <code>Reference</code>
-     * @throws ClassCastException if any of the transforms (in either list)
-     *    are not of type <code>Transform</code>
-     * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
-     *    compliant or <code>appliedTransforms</code> is empty
-     * @throws NullPointerException if <code>dm</code>,
-     *    <code>appliedTransforms</code> or <code>result</code> is
-     *    <code>null</code>
-     */
-    public abstract Reference newReference(String uri, DigestMethod dm,
-        List appliedTransforms, Data result, List transforms, String type,
-        String id);
-
-    /**
-     * Creates a <code>SignedInfo</code> with the specified canonicalization
-     * and signature methods, and list of one or more references.
-     *
-     * @param cm the canonicalization method
-     * @param sm the signature method
-     * @param references a list of one or more {@link Reference}s. The list is
-     *    defensively copied to protect against subsequent modification.
-     * @return a <code>SignedInfo</code>
-     * @throws ClassCastException if any of the references are not of
-     *    type <code>Reference</code>
-     * @throws IllegalArgumentException if <code>references</code> is empty
-     * @throws NullPointerException if any of the parameters
-     *    are <code>null</code>
-     */
-    public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references);
-
-    /**
-     * Creates a <code>SignedInfo</code> with the specified parameters.
-     *
-     * @param cm the canonicalization method
-     * @param sm the signature method
-     * @param references a list of one or more {@link Reference}s. The list is
-     *    defensively copied to protect against subsequent modification.
-     * @param id the id (may be <code>null</code>)
-     * @return a <code>SignedInfo</code>
-     * @throws ClassCastException if any of the references are not of
-     *    type <code>Reference</code>
-     * @throws IllegalArgumentException if <code>references</code> is empty
-     * @throws NullPointerException if <code>cm</code>, <code>sm</code>, or
-     *    <code>references</code> are <code>null</code>
-     */
-    public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references, String id);
-
-    // Object factory methods
-    /**
-     * Creates an <code>XMLObject</code> from the specified parameters.
-     *
-     * @param content a list of {@link XMLStructure}s. The list
-     *    is defensively copied to protect against subsequent modification.
-     *    May be <code>null</code> or empty.
-     * @param id the Id (may be <code>null</code>)
-     * @param mimeType the mime type (may be <code>null</code>)
-     * @param encoding the encoding (may be <code>null</code>)
-     * @return an <code>XMLObject</code>
-     * @throws ClassCastException if <code>content</code> contains any
-     *    entries that are not of type {@link XMLStructure}
-     */
-    public abstract XMLObject newXMLObject(List content, String id,
-        String mimeType, String encoding);
-
-    /**
-     * Creates a <code>Manifest</code> containing the specified
-     * list of {@link Reference}s.
-     *
-     * @param references a list of one or more <code>Reference</code>s. The list
-     *    is defensively copied to protect against subsequent modification.
-     * @return a <code>Manifest</code>
-     * @throws NullPointerException if <code>references</code> is
-     *    <code>null</code>
-     * @throws IllegalArgumentException if <code>references</code> is empty
-     * @throws ClassCastException if <code>references</code> contains any
-     *    entries that are not of type {@link Reference}
-     */
-    public abstract Manifest newManifest(List references);
-
-    /**
-     * Creates a <code>Manifest</code> containing the specified
-     * list of {@link Reference}s and optional id.
-     *
-     * @param references a list of one or more <code>Reference</code>s. The list
-     *    is defensively copied to protect against subsequent modification.
-     * @param id the id (may be <code>null</code>)
-     * @return a <code>Manifest</code>
-     * @throws NullPointerException if <code>references</code> is
-     *    <code>null</code>
-     * @throws IllegalArgumentException if <code>references</code> is empty
-     * @throws ClassCastException if <code>references</code> contains any
-     *    entries that are not of type {@link Reference}
-     */
-    public abstract Manifest newManifest(List references, String id);
-
-    /**
-     * Creates a <code>SignatureProperty</code> containing the specified
-     * list of {@link XMLStructure}s, target URI and optional id.
-     *
-     * @param content a list of one or more <code>XMLStructure</code>s. The list
-     *    is defensively copied to protect against subsequent modification.
-     * @param target the target URI of the Signature that this property applies
-     *    to
-     * @param id the id (may be <code>null</code>)
-     * @return a <code>SignatureProperty</code>
-     * @throws NullPointerException if <code>content</code> or
-     *    <code>target</code> is <code>null</code>
-     * @throws IllegalArgumentException if <code>content</code> is empty
-     * @throws ClassCastException if <code>content</code> contains any
-     *    entries that are not of type {@link XMLStructure}
-     */
-    public abstract SignatureProperty newSignatureProperty
-        (List content, String target, String id);
-
-    /**
-     * Creates a <code>SignatureProperties</code> containing the specified
-     * list of {@link SignatureProperty}s and optional id.
-     *
-     * @param properties a list of one or more <code>SignatureProperty</code>s.
-     *    The list is defensively copied to protect against subsequent
-     *    modification.
-     * @param id the id (may be <code>null</code>)
-     * @return a <code>SignatureProperties</code>
-     * @throws NullPointerException if <code>properties</code>
-     *    is <code>null</code>
-     * @throws IllegalArgumentException if <code>properties</code> is empty
-     * @throws ClassCastException if <code>properties</code> contains any
-     *    entries that are not of type {@link SignatureProperty}
-     */
-    public abstract SignatureProperties newSignatureProperties
-        (List properties, String id);
-
-    // Algorithm factory methods
-    /**
-     * Creates a <code>DigestMethod</code> for the specified algorithm URI
-     * and parameters.
-     *
-     * @param algorithm the URI identifying the digest algorithm
-     * @param params algorithm-specific digest parameters (may be
-     *    <code>null</code>)
-     * @return the <code>DigestMethod</code>
-     * @throws InvalidAlgorithmParameterException if the specified parameters
-     *    are inappropriate for the requested algorithm
-     * @throws NoSuchAlgorithmException if an implementation of the
-     *    specified algorithm cannot be found
-     * @throws NullPointerException if <code>algorithm</code> is
-     *    <code>null</code>
-     */
-    public abstract DigestMethod newDigestMethod(String algorithm,
-        DigestMethodParameterSpec params) throws NoSuchAlgorithmException,
-        InvalidAlgorithmParameterException;
-
-    /**
-     * Creates a <code>SignatureMethod</code> for the specified algorithm URI
-     * and parameters.
-     *
-     * @param algorithm the URI identifying the signature algorithm
-     * @param params algorithm-specific signature parameters (may be
-     *    <code>null</code>)
-     * @return the <code>SignatureMethod</code>
-     * @throws InvalidAlgorithmParameterException if the specified parameters
-     *    are inappropriate for the requested algorithm
-     * @throws NoSuchAlgorithmException if an implementation of the
-     *    specified algorithm cannot be found
-     * @throws NullPointerException if <code>algorithm</code> is
-     *    <code>null</code>
-     */
-    public abstract SignatureMethod newSignatureMethod(String algorithm,
-        SignatureMethodParameterSpec params) throws NoSuchAlgorithmException,
-        InvalidAlgorithmParameterException;
-
-    /**
-     * Creates a <code>Transform</code> for the specified algorithm URI
-     * and parameters.
-     *
-     * @param algorithm the URI identifying the transform algorithm
-     * @param params algorithm-specific transform parameters (may be
-     *    <code>null</code>)
-     * @return the <code>Transform</code>
-     * @throws InvalidAlgorithmParameterException if the specified parameters
-     *    are inappropriate for the requested algorithm
-     * @throws NoSuchAlgorithmException if an implementation of the
-     *    specified algorithm cannot be found
-     * @throws NullPointerException if <code>algorithm</code> is
-     *    <code>null</code>
-     */
-    public abstract Transform newTransform(String algorithm,
-        TransformParameterSpec params) throws NoSuchAlgorithmException,
-        InvalidAlgorithmParameterException;
-
-    /**
-     * Creates a <code>Transform</code> for the specified algorithm URI
-     * and parameters. The parameters are specified as a mechanism-specific
-     * <code>XMLStructure</code> (ex: {@link DOMStructure}). This method is
-     * useful when the parameters are in XML form or there is no standard
-     * class for specifying the parameters.
-     *
-     * @param algorithm the URI identifying the transform algorithm
-     * @param params a mechanism-specific XML structure from which to
-     *   unmarshal the parameters from (may be <code>null</code> if
-     *   not required or optional)
-     * @return the <code>Transform</code>
-     * @throws ClassCastException if the type of <code>params</code> is
-     *   inappropriate for this <code>XMLSignatureFactory</code>
-     * @throws InvalidAlgorithmParameterException if the specified parameters
-     *    are inappropriate for the requested algorithm
-     * @throws NoSuchAlgorithmException if an implementation of the
-     *    specified algorithm cannot be found
-     * @throws NullPointerException if <code>algorithm</code> is
-     *    <code>null</code>
-     */
-    public abstract Transform newTransform(String algorithm,
-        XMLStructure params) throws NoSuchAlgorithmException,
-        InvalidAlgorithmParameterException;
-
-    /**
-     * Creates a <code>CanonicalizationMethod</code> for the specified
-     * algorithm URI and parameters.
-     *
-     * @param algorithm the URI identifying the canonicalization algorithm
-     * @param params algorithm-specific canonicalization parameters (may be
-     *    <code>null</code>)
-     * @return the <code>CanonicalizationMethod</code>
-     * @throws InvalidAlgorithmParameterException if the specified parameters
-     *    are inappropriate for the requested algorithm
-     * @throws NoSuchAlgorithmException if an implementation of the
-     *    specified algorithm cannot be found
-     * @throws NullPointerException if <code>algorithm</code> is
-     *    <code>null</code>
-     */
-    public abstract CanonicalizationMethod newCanonicalizationMethod(
-        String algorithm, C14NMethodParameterSpec params)
-        throws NoSuchAlgorithmException, InvalidAlgorithmParameterException;
-
-    /**
-     * Creates a <code>CanonicalizationMethod</code> for the specified
-     * algorithm URI and parameters. The parameters are specified as a
-     * mechanism-specific <code>XMLStructure</code> (ex: {@link DOMStructure}).
-     * This method is useful when the parameters are in XML form or there is
-     * no standard class for specifying the parameters.
-     *
-     * @param algorithm the URI identifying the canonicalization algorithm
-     * @param params a mechanism-specific XML structure from which to
-     *   unmarshal the parameters from (may be <code>null</code> if
-     *   not required or optional)
-     * @return the <code>CanonicalizationMethod</code>
-     * @throws ClassCastException if the type of <code>params</code> is
-     *   inappropriate for this <code>XMLSignatureFactory</code>
-     * @throws InvalidAlgorithmParameterException if the specified parameters
-     *    are inappropriate for the requested algorithm
-     * @throws NoSuchAlgorithmException if an implementation of the
-     *    specified algorithm cannot be found
-     * @throws NullPointerException if <code>algorithm</code> is
-     *    <code>null</code>
-     */
-    public abstract CanonicalizationMethod newCanonicalizationMethod(
-        String algorithm, XMLStructure params)
-        throws NoSuchAlgorithmException, InvalidAlgorithmParameterException;
-
-    /**
-     * Returns a <code>KeyInfoFactory</code> that creates <code>KeyInfo</code>
-     * objects. The returned <code>KeyInfoFactory</code> has the same
-     * mechanism type and provider as this <code>XMLSignatureFactory</code>.
-     *
-     * @return a <code>KeyInfoFactory</code>
-     * @throws NoSuchMechanismException if a <code>KeyFactory</code>
-     *    implementation with the same mechanism type and provider
-     *    is not available
-     */
-    public final KeyInfoFactory getKeyInfoFactory() {
-        return KeyInfoFactory.getInstance(getMechanismType(), getProvider());
-    }
-
-    /**
-     * Unmarshals a new <code>XMLSignature</code> instance from a
-     * mechanism-specific <code>XMLValidateContext</code> instance.
-     *
-     * @param context a mechanism-specific context from which to unmarshal the
-     *    signature from
-     * @return the <code>XMLSignature</code>
-     * @throws NullPointerException if <code>context</code> is
-     *    <code>null</code>
-     * @throws ClassCastException if the type of <code>context</code> is
-     *    inappropriate for this factory
-     * @throws MarshalException if an unrecoverable exception occurs
-     *    during unmarshalling
-     */
-    public abstract XMLSignature unmarshalXMLSignature
-        (XMLValidateContext context) throws MarshalException;
-
-    /**
-     * Unmarshals a new <code>XMLSignature</code> instance from a
-     * mechanism-specific <code>XMLStructure</code> instance.
-     * This method is useful if you only want to unmarshal (and not
-     * validate) an <code>XMLSignature</code>.
-     *
-     * @param xmlStructure a mechanism-specific XML structure from which to
-     *    unmarshal the signature from
-     * @return the <code>XMLSignature</code>
-     * @throws NullPointerException if <code>xmlStructure</code> is
-     *    <code>null</code>
-     * @throws ClassCastException if the type of <code>xmlStructure</code> is
-     *    inappropriate for this factory
-     * @throws MarshalException if an unrecoverable exception occurs
-     *    during unmarshalling
-     */
-    public abstract XMLSignature unmarshalXMLSignature
-        (XMLStructure xmlStructure) throws MarshalException;
-
-    /**
-     * Indicates whether a specified feature is supported.
-     *
-     * @param feature the feature name (as an absolute URI)
-     * @return <code>true</code> if the specified feature is supported,
-     *    <code>false</code> otherwise
-     * @throws NullPointerException if <code>feature</code> is <code>null</code>
-     */
-    public abstract boolean isFeatureSupported(String feature);
-
-    /**
-     * Returns a reference to the <code>URIDereferencer</code> that is used by
-     * default to dereference URIs in {@link Reference} objects.
-     *
-     * @return a reference to the default <code>URIDereferencer</code> (never
-     *    <code>null</code>)
-     */
-    public abstract URIDereferencer getURIDereferencer();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLValidateContext.java b/ojluni/src/main/java/javax/xml/crypto/dsig/XMLValidateContext.java
deleted file mode 100755
index 2567314..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/XMLValidateContext.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XMLValidateContext.java,v 1.8 2005/05/10 16:03:49 mullan Exp $
- */
-package javax.xml.crypto.dsig;
-
-import javax.xml.crypto.XMLCryptoContext;
-
-/**
- * Contains context information for validating XML Signatures. This interface
- * is primarily intended for type-safety.
- *
- * <p>Note that <code>XMLValidateContext</code> instances can contain
- * information and state specific to the XML signature structure it is
- * used with. The results are unpredictable if an
- * <code>XMLValidateContext</code> is used with different signature structures
- * (for example, you should not use the same <code>XMLValidateContext</code>
- * instance to validate two different {@link XMLSignature} objects).
- * <p>
- * <b><a name="Supported Properties"></a>Supported Properties</b>
- * <p>The following properties can be set by an application using the
- * {@link #setProperty setProperty} method.
- * <ul>
- *   <li><code>javax.xml.crypto.dsig.cacheReference</code>: value must be a
- *      {@link Boolean}. This property controls whether or not the
- *      {@link Reference#validate Reference.validate} method will cache the
- *      dereferenced content and pre-digested input for subsequent retrieval via
- *      the {@link Reference#getDereferencedData Reference.getDereferencedData}
- *      and {@link Reference#getDigestInputStream
- *      Reference.getDigestInputStream} methods. The default value if not
- *      specified is <code>Boolean.FALSE</code>.
- * </ul>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignature#validate(XMLValidateContext)
- * @see Reference#validate(XMLValidateContext)
- */
-public interface XMLValidateContext extends XMLCryptoContext {}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/dom/DOMSignContext.java b/ojluni/src/main/java/javax/xml/crypto/dsig/dom/DOMSignContext.java
deleted file mode 100755
index 4cb8ead..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/dom/DOMSignContext.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: DOMSignContext.java,v 1.9 2005/05/10 16:31:14 mullan Exp $
- */
-package javax.xml.crypto.dsig.dom;
-
-import javax.xml.crypto.KeySelector;
-import javax.xml.crypto.dom.DOMCryptoContext;
-import javax.xml.crypto.dsig.XMLSignContext;
-import javax.xml.crypto.dsig.XMLSignature;
-import java.security.Key;
-import org.w3c.dom.Node;
-
-/**
- * A DOM-specific {@link XMLSignContext}. This class contains additional methods
- * to specify the location in a DOM tree where an {@link XMLSignature}
- * object is to be marshalled when generating the signature.
- *
- * <p>Note that <code>DOMSignContext</code> instances can contain
- * information and state specific to the XML signature structure it is
- * used with. The results are unpredictable if a
- * <code>DOMSignContext</code> is used with different signature structures
- * (for example, you should not use the same <code>DOMSignContext</code>
- * instance to sign two different {@link XMLSignature} objects).
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public class DOMSignContext extends DOMCryptoContext implements XMLSignContext {
-
-    private Node parent;
-    private Node nextSibling;
-
-    /**
-     * Creates a <code>DOMSignContext</code> with the specified signing key
-     * and parent node. The signing key is stored in a
-     * {@link KeySelector#singletonKeySelector singleton KeySelector} that is
-     * returned by the {@link #getKeySelector getKeySelector} method.
-     * The marshalled <code>XMLSignature</code> will be added as the last
-     * child element of the specified parent node unless a next sibling node is
-     * specified by invoking the {@link #setNextSibling setNextSibling} method.
-     *
-     * @param signingKey the signing key
-     * @param parent the parent node
-     * @throws NullPointerException if <code>signingKey</code> or
-     *    <code>parent</code> is <code>null</code>
-     */
-    public DOMSignContext(Key signingKey, Node parent) {
-        if (signingKey == null) {
-            throw new NullPointerException("signingKey cannot be null");
-        }
-        if (parent == null) {
-            throw new NullPointerException("parent cannot be null");
-        }
-        setKeySelector(KeySelector.singletonKeySelector(signingKey));
-        this.parent = parent;
-    }
-
-    /**
-     * Creates a <code>DOMSignContext</code> with the specified signing key,
-     * parent and next sibling nodes. The signing key is stored in a
-     * {@link KeySelector#singletonKeySelector singleton KeySelector} that is
-     * returned by the {@link #getKeySelector getKeySelector} method.
-     * The marshalled <code>XMLSignature</code> will be inserted as a child
-     * element of the specified parent node and immediately before the
-     * specified next sibling node.
-     *
-     * @param signingKey the signing key
-     * @param parent the parent node
-     * @param nextSibling the next sibling node
-     * @throws NullPointerException if <code>signingKey</code>,
-     *    <code>parent</code> or <code>nextSibling</code> is <code>null</code>
-     */
-    public DOMSignContext(Key signingKey, Node parent, Node nextSibling) {
-        if (signingKey == null) {
-            throw new NullPointerException("signingKey cannot be null");
-        }
-        if (parent == null) {
-            throw new NullPointerException("parent cannot be null");
-        }
-        if (nextSibling == null) {
-            throw new NullPointerException("nextSibling cannot be null");
-        }
-        setKeySelector(KeySelector.singletonKeySelector(signingKey));
-        this.parent = parent;
-        this.nextSibling = nextSibling;
-    }
-
-    /**
-     * Creates a <code>DOMSignContext</code> with the specified key selector
-     * and parent node. The marshalled <code>XMLSignature</code> will be added
-     * as the last child element of the specified parent node unless a next
-     * sibling node is specified by invoking the
-     * {@link #setNextSibling setNextSibling} method.
-     *
-     * @param ks the key selector
-     * @param parent the parent node
-     * @throws NullPointerException if <code>ks</code> or <code>parent</code>
-     *    is <code>null</code>
-     */
-    public DOMSignContext(KeySelector ks, Node parent) {
-        if (ks == null) {
-            throw new NullPointerException("key selector cannot be null");
-        }
-        if (parent == null) {
-            throw new NullPointerException("parent cannot be null");
-        }
-        setKeySelector(ks);
-        this.parent = parent;
-    }
-
-    /**
-     * Creates a <code>DOMSignContext</code> with the specified key selector,
-     * parent and next sibling nodes. The marshalled <code>XMLSignature</code>
-     * will be inserted as a child element of the specified parent node and
-     * immediately before the specified next sibling node.
-     *
-     * @param ks the key selector
-     * @param parent the parent node
-     * @param nextSibling the next sibling node
-     * @throws NullPointerException if <code>ks</code>, <code>parent</code> or
-     *    <code>nextSibling</code> is <code>null</code>
-     */
-    public DOMSignContext(KeySelector ks, Node parent, Node nextSibling) {
-        if (ks == null) {
-            throw new NullPointerException("key selector cannot be null");
-        }
-        if (parent == null) {
-            throw new NullPointerException("parent cannot be null");
-        }
-        if (nextSibling == null) {
-            throw new NullPointerException("nextSibling cannot be null");
-        }
-        setKeySelector(ks);
-        this.parent = parent;
-        this.nextSibling = nextSibling;
-    }
-
-    /**
-     * Sets the parent node.
-     *
-     * @param parent the parent node. The marshalled <code>XMLSignature</code>
-     *    will be added as a child element of this node.
-     * @throws NullPointerException if <code>parent</code> is <code>null</code>
-     * @see #getParent
-     */
-    public void setParent(Node parent) {
-        if (parent == null) {
-            throw new NullPointerException("parent is null");
-        }
-        this.parent = parent;
-    }
-
-    /**
-     * Sets the next sibling node.
-     *
-     * @param nextSibling the next sibling node. The marshalled
-     *    <code>XMLSignature</code> will be inserted immediately before this
-     *    node. Specify <code>null</code> to remove the current setting.
-     * @see #getNextSibling
-     */
-    public void setNextSibling(Node nextSibling) {
-        this.nextSibling = nextSibling;
-    }
-
-    /**
-     * Returns the parent node.
-     *
-     * @return the parent node (never <code>null</code>)
-     * @see #setParent(Node)
-     */
-    public Node getParent() {
-        return parent;
-    }
-
-    /**
-     * Returns the nextSibling node.
-     *
-     * @return the nextSibling node, or <code>null</code> if not specified.
-     * @see #setNextSibling(Node)
-     */
-    public Node getNextSibling() {
-        return nextSibling;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/dom/DOMValidateContext.java b/ojluni/src/main/java/javax/xml/crypto/dsig/dom/DOMValidateContext.java
deleted file mode 100755
index 70e6d45..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/dom/DOMValidateContext.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: DOMValidateContext.java,v 1.8 2005/05/10 16:31:14 mullan Exp $
- */
-package javax.xml.crypto.dsig.dom;
-
-import javax.xml.crypto.KeySelector;
-import javax.xml.crypto.dom.DOMCryptoContext;
-import javax.xml.crypto.dsig.XMLSignature;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.XMLValidateContext;
-import java.security.Key;
-import org.w3c.dom.Node;
-
-/**
- * A DOM-specific {@link XMLValidateContext}. This class contains additional
- * methods to specify the location in a DOM tree where an {@link XMLSignature}
- * is to be unmarshalled and validated from.
- *
- * <p>Note that the behavior of an unmarshalled <code>XMLSignature</code>
- * is undefined if the contents of the underlying DOM tree are modified by the
- * caller after the <code>XMLSignature</code> is created.
- *
- * <p>Also, note that <code>DOMValidateContext</code> instances can contain
- * information and state specific to the XML signature structure it is
- * used with. The results are unpredictable if a
- * <code>DOMValidateContext</code> is used with different signature structures
- * (for example, you should not use the same <code>DOMValidateContext</code>
- * instance to validate two different {@link XMLSignature} objects).
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XMLSignatureFactory#unmarshalXMLSignature(XMLValidateContext)
- */
-public class DOMValidateContext extends DOMCryptoContext
-    implements XMLValidateContext {
-
-    private Node node;
-
-    /**
-     * Creates a <code>DOMValidateContext</code> containing the specified key
-     * selector and node.
-     *
-     * @param ks a key selector for finding a validation key
-     * @param node the node
-     * @throws NullPointerException if <code>ks</code> or <code>node</code> is
-     *    <code>null</code>
-     */
-    public DOMValidateContext(KeySelector ks, Node node) {
-        if (ks == null) {
-            throw new NullPointerException("key selector is null");
-        }
-        init(node, ks);
-    }
-
-    /**
-     * Creates a <code>DOMValidateContext</code> containing the specified key
-     * and node. The validating key will be stored in a
-     * {@link KeySelector#singletonKeySelector singleton KeySelector} that
-     * is returned when the {@link #getKeySelector getKeySelector}
-     * method is called.
-     *
-     * @param validatingKey the validating key
-     * @param node the node
-     * @throws NullPointerException if <code>validatingKey</code> or
-     *    <code>node</code> is <code>null</code>
-     */
-    public DOMValidateContext(Key validatingKey, Node node) {
-        if (validatingKey == null) {
-            throw new NullPointerException("validatingKey is null");
-        }
-        init(node, KeySelector.singletonKeySelector(validatingKey));
-    }
-
-    private void init(Node node, KeySelector ks) {
-        if (node == null) {
-            throw new NullPointerException("node is null");
-        }
-
-        this.node = node;
-        super.setKeySelector(ks);
-        if (System.getSecurityManager() != null) {
-            super.setProperty("org.jcp.xml.dsig.secureValidation",
-                              Boolean.TRUE);
-        }
-    }
-
-    /**
-     * Sets the node.
-     *
-     * @param node the node
-     * @throws NullPointerException if <code>node</code> is <code>null</code>
-     * @see #getNode
-     */
-    public void setNode(Node node) {
-        if (node == null) {
-            throw new NullPointerException();
-        }
-        this.node = node;
-    }
-
-    /**
-     * Returns the node.
-     *
-     * @return the node (never <code>null</code>)
-     * @see #setNode(Node)
-     */
-    public Node getNode() {
-        return node;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/dom/package.html b/ojluni/src/main/java/javax/xml/crypto/dsig/dom/package.html
deleted file mode 100755
index 7449617..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/dom/package.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body>
-DOM-specific classes for the {@link javax.xml.crypto.dsig} package. 
-Only users who are using a DOM-based {@link 
-javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or 
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory} 
-should need to make direct use of this package.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-<p>
-<dl>
-<dt><b>Since:</b></dt>
-  <dd>1.6</dd>
-</dl>
-
-</body>
-</html>
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyInfo.java b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyInfo.java
deleted file mode 100755
index a9f9833..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyInfo.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: KeyInfo.java,v 1.7 2005/05/10 16:35:34 mullan Exp $
- */
-package javax.xml.crypto.dsig.keyinfo;
-
-import java.util.List;
-import javax.xml.crypto.MarshalException;
-import javax.xml.crypto.XMLCryptoContext;
-import javax.xml.crypto.XMLStructure;
-
-/**
- * A representation of the XML <code>KeyInfo</code> element as defined in
- * the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * A <code>KeyInfo</code> contains a list of {@link XMLStructure}s, each of
- * which contain information that enables the recipient(s) to obtain the key
- * needed to validate an XML signature. The XML Schema Definition is defined as:
- *
- * <pre>
- * &lt;element name="KeyInfo" type="ds:KeyInfoType"/&gt;
- * &lt;complexType name="KeyInfoType" mixed="true"&gt;
- *   &lt;choice maxOccurs="unbounded"&gt;
- *     &lt;element ref="ds:KeyName"/&gt;
- *     &lt;element ref="ds:KeyValue"/&gt;
- *     &lt;element ref="ds:RetrievalMethod"/&gt;
- *     &lt;element ref="ds:X509Data"/&gt;
- *     &lt;element ref="ds:PGPData"/&gt;
- *     &lt;element ref="ds:SPKIData"/&gt;
- *     &lt;element ref="ds:MgmtData"/&gt;
- *     &lt;any processContents="lax" namespace="##other"/&gt;
- *     &lt;!-- (1,1) elements from (0,unbounded) namespaces --&gt;
- *   &lt;/choice&gt;
- *   &lt;attribute name="Id" type="ID" use="optional"/&gt;
- * &lt;/complexType&gt;
- * </pre>
- *
- * A <code>KeyInfo</code> instance may be created by invoking one of the
- * {@link KeyInfoFactory#newKeyInfo newKeyInfo} methods of the
- * {@link KeyInfoFactory} class, and passing it a list of one or more
- * <code>XMLStructure</code>s and an optional id parameter;
- * for example:
- * <pre>
- *   KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
- *   KeyInfo keyInfo = factory.newKeyInfo
- *      (Collections.singletonList(factory.newKeyName("Alice"), "keyinfo-1"));
- * </pre>
- *
- * <p><code>KeyInfo</code> objects can also be marshalled to XML by invoking
- * the {@link #marshal marshal} method.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see KeyInfoFactory#newKeyInfo(List)
- * @see KeyInfoFactory#newKeyInfo(List, String)
- */
-public interface KeyInfo extends XMLStructure {
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} containing the key information. Each entry of the list is
-     * an {@link XMLStructure}.
-     *
-     * <p>If there is a public subclass representing the type of
-     * <code>XMLStructure</code>, it is returned as an instance of that
-     * class (ex: an <code>X509Data</code> element would be returned as an
-     * instance of {@link javax.xml.crypto.dsig.keyinfo.X509Data}).
-     *
-     * @return an unmodifiable list of one or more <code>XMLStructure</code>s
-     *    in this <code>KeyInfo</code>. Never returns <code>null</code> or an
-     *    empty list.
-     */
-    List getContent();
-
-    /**
-     * Return the optional Id attribute of this <code>KeyInfo</code>, which
-     * may be useful for referencing this <code>KeyInfo</code> from other
-     * XML structures.
-     *
-     * @return the Id attribute of this <code>KeyInfo</code> (may be
-     *    <code>null</code> if not specified)
-     */
-    String getId();
-
-    /**
-     * Marshals the key info to XML.
-     *
-     * @param parent a mechanism-specific structure containing the parent node
-     *    that the marshalled key info will be appended to
-     * @param context the <code>XMLCryptoContext</code> containing additional
-     *    context (may be null if not applicable)
-     * @throws ClassCastException if the type of <code>parent</code> or
-     *    <code>context</code> is not compatible with this key info
-     * @throws MarshalException if the key info cannot be marshalled
-     * @throws NullPointerException if <code>parent</code> is <code>null</code>
-     */
-    void marshal(XMLStructure parent, XMLCryptoContext context)
-        throws MarshalException;
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
deleted file mode 100755
index 54fd53b..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: KeyInfoFactory.java,v 1.12 2005/05/10 16:35:35 mullan Exp $
- */
-package javax.xml.crypto.dsig.keyinfo;
-
-import java.math.BigInteger;
-import java.security.KeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.PublicKey;
-import java.security.Security;
-import java.security.cert.X509CRL;
-import java.util.List;
-import javax.xml.crypto.MarshalException;
-import javax.xml.crypto.NoSuchMechanismException;
-import javax.xml.crypto.URIDereferencer;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dom.DOMStructure;
-import javax.xml.crypto.dsig.*;
-
-import sun.security.jca.*;
-import sun.security.jca.GetInstance.Instance;
-
-/**
- * A factory for creating {@link KeyInfo} objects from scratch or for
- * unmarshalling a <code>KeyInfo</code> object from a corresponding XML
- * representation.
- *
- * <p>Each instance of <code>KeyInfoFactory</code> supports a specific
- * XML mechanism type. To create a <code>KeyInfoFactory</code>, call one of the
- * static {@link #getInstance getInstance} methods, passing in the XML
- * mechanism type desired, for example:
- *
- * <blockquote><code>
- *   KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
- * </code></blockquote>
- *
- * <p>The objects that this factory produces will be based
- * on DOM and abide by the DOM interoperability requirements as defined in the
- * <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#DOM Mechanism Requirements">
- * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
- * Service Providers</a> section of the API overview for a list of standard
- * mechanism types.
- *
- * <p><code>KeyInfoFactory</code> implementations are registered and loaded
- * using the {@link java.security.Provider} mechanism.
- * For example, a service provider that supports the
- * DOM mechanism would be specified in the <code>Provider</code> subclass as:
- * <pre>
- *     put("KeyInfoFactory.DOM", "org.example.DOMKeyInfoFactory");
- * </pre>
- *
- * <p>Also, the <code>XMLStructure</code>s that are created by this factory
- * may contain state specific to the <code>KeyInfo</code> and are not
- * intended to be reusable.
- *
- * <p>An implementation MUST minimally support the default mechanism type: DOM.
- *
- * <p>Note that a caller must use the same <code>KeyInfoFactory</code>
- * instance to create the <code>XMLStructure</code>s of a particular
- * <code>KeyInfo</code> object. The behavior is undefined if
- * <code>XMLStructure</code>s from different providers or different mechanism
- * types are used together.
- *
- * <p><b>Concurrent Access</b>
- * <p>The static methods of this class are guaranteed to be thread-safe.
- * Multiple threads may concurrently invoke the static methods defined in this
- * class with no ill effects.
- *
- * <p>However, this is not true for the non-static methods defined by this
- * class. Unless otherwise documented by a specific provider, threads that
- * need to access a single <code>KeyInfoFactory</code> instance concurrently
- * should synchronize amongst themselves and provide the necessary locking.
- * Multiple threads each manipulating a different <code>KeyInfoFactory</code>
- * instance need not synchronize.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- */
-public abstract class KeyInfoFactory {
-
-    private String mechanismType;
-    private Provider provider;
-
-    /**
-     * Default constructor, for invocation by subclasses.
-     */
-    protected KeyInfoFactory() {}
-
-    /**
-     * Returns a <code>KeyInfoFactory</code> that supports the
-     * specified XML processing mechanism and representation type (ex: "DOM").
-     *
-     * <p>This method uses the standard JCA provider lookup mechanism to
-     * locate and instantiate a <code>KeyInfoFactory</code> implementation of
-     * the desired mechanism type. It traverses the list of registered security
-     * <code>Provider</code>s, starting with the most preferred
-     * <code>Provider</code>. A new <code>KeyInfoFactory</code> object
-     * from the first <code>Provider</code> that supports the specified
-     * mechanism is returned.
-     *
-     * <p> Note that the list of registered providers may be retrieved via
-     * the {@link Security#getProviders() Security.getProviders()} method.
-     *
-     * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the <a
-     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
-     *    Service Providers</a> section of the API overview for a list of
-     *    standard mechanism types.
-     * @return a new <code>KeyInfoFactory</code>
-     * @throws NullPointerException if <code>mechanismType</code> is
-     *    <code>null</code>
-     * @throws NoSuchMechanismException if no <code>Provider</code> supports a
-     *    <code>KeyInfoFactory</code> implementation for the specified mechanism
-     * @see Provider
-     */
-    public static KeyInfoFactory getInstance(String mechanismType) {
-        if (mechanismType == null) {
-            throw new NullPointerException("mechanismType cannot be null");
-        }
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("KeyInfoFactory", null, mechanismType);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
-        }
-        KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
-    }
-
-    /**
-     * Returns a <code>KeyInfoFactory</code> that supports the
-     * requested XML processing mechanism and representation type (ex: "DOM"),
-     * as supplied by the specified provider. Note that the specified
-     * <code>Provider</code> object does not have to be registered in the
-     * provider list.
-     *
-     * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the <a
-     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
-     *    Service Providers</a> section of the API overview for a list of
-     *    standard mechanism types.
-     * @param provider the <code>Provider</code> object
-     * @return a new <code>KeyInfoFactory</code>
-     * @throws NullPointerException if <code>mechanismType</code> or
-     *    <code>provider</code> are <code>null</code>
-     * @throws NoSuchMechanismException if a <code>KeyInfoFactory</code>
-     *    implementation for the specified mechanism is not available from the
-     *    specified <code>Provider</code> object
-     * @see Provider
-     */
-    public static KeyInfoFactory getInstance(String mechanismType,
-        Provider provider) {
-        if (mechanismType == null) {
-            throw new NullPointerException("mechanismType cannot be null");
-        } else if (provider == null) {
-            throw new NullPointerException("provider cannot be null");
-        }
-
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("KeyInfoFactory", null, mechanismType, provider);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
-        }
-        KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
-    }
-
-    /**
-     * Returns a <code>KeyInfoFactory</code> that supports the
-     * requested XML processing mechanism and representation type (ex: "DOM"),
-     * as supplied by the specified provider. The specified provider must be
-     * registered in the security provider list.
-     *
-     * <p>Note that the list of registered providers may be retrieved via
-     * the {@link Security#getProviders() Security.getProviders()} method.
-     *
-     * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the <a
-     *    href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
-     *    Service Providers</a> section of the API overview for a list of
-     *    standard mechanism types.
-     * @param provider the string name of the provider
-     * @return a new <code>KeyInfoFactory</code>
-     * @throws NoSuchProviderException if the specified provider is not
-     *    registered in the security provider list
-     * @throws NullPointerException if <code>mechanismType</code> or
-     *    <code>provider</code> are <code>null</code>
-     * @throws NoSuchMechanismException if a <code>KeyInfoFactory</code>
-     *    implementation for the specified mechanism is not available from the
-     *    specified provider
-     * @see Provider
-     */
-    public static KeyInfoFactory getInstance(String mechanismType,
-        String provider) throws NoSuchProviderException {
-        if (mechanismType == null) {
-            throw new NullPointerException("mechanismType cannot be null");
-        } else if (provider == null) {
-            throw new NullPointerException("provider cannot be null");
-        } else if (provider.length() == 0) {
-            throw new NoSuchProviderException();
-        }
-
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("KeyInfoFactory", null, mechanismType, provider);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
-        }
-        KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
-    }
-
-    /**
-     * Returns a <code>KeyInfoFactory</code> that supports the
-     * default XML processing mechanism and representation type ("DOM").
-     *
-     * <p>This method uses the standard JCA provider lookup mechanism to
-     * locate and instantiate a <code>KeyInfoFactory</code> implementation of
-     * the default mechanism type. It traverses the list of registered security
-     * <code>Provider</code>s, starting with the most preferred
-     * <code>Provider</code>.  A new <code>KeyInfoFactory</code> object
-     * from the first <code>Provider</code> that supports the DOM mechanism is
-     * returned.
-     *
-     * <p> Note that the list of registered providers may be retrieved via
-     * the {@link Security#getProviders() Security.getProviders()} method.
-     *
-     * @return a new <code>KeyInfoFactory</code>
-     * @throws NoSuchMechanismException if no <code>Provider</code> supports a
-     *    <code>KeyInfoFactory</code> implementation for the DOM mechanism
-     * @see Provider
-     */
-    public static KeyInfoFactory getInstance() {
-        return getInstance("DOM");
-    }
-
-    /**
-     * Returns the type of the XML processing mechanism and representation
-     * supported by this <code>KeyInfoFactory</code> (ex: "DOM")
-     *
-     * @return the XML processing mechanism type supported by this
-     *    <code>KeyInfoFactory</code>
-     */
-    public final String getMechanismType() {
-        return mechanismType;
-    }
-
-    /**
-     * Returns the provider of this <code>KeyInfoFactory</code>.
-     *
-     * @return the provider of this <code>KeyInfoFactory</code>
-     */
-    public final Provider getProvider() {
-        return provider;
-    }
-
-    /**
-     * Creates a <code>KeyInfo</code> containing the specified list of
-     * key information types.
-     *
-     * @param content a list of one or more {@link XMLStructure}s representing
-     *    key information types. The list is defensively copied to protect
-     *    against subsequent modification.
-     * @return a <code>KeyInfo</code>
-     * @throws NullPointerException if <code>content</code> is <code>null</code>
-     * @throws IllegalArgumentException if <code>content</code> is empty
-     * @throws ClassCastException if <code>content</code> contains any entries
-     *    that are not of type {@link XMLStructure}
-     */
-    public abstract KeyInfo newKeyInfo(List content);
-
-    /**
-     * Creates a <code>KeyInfo</code> containing the specified list of key
-     * information types and optional id. The
-     * <code>id</code> parameter represents the value of an XML
-     * <code>ID</code> attribute and is useful for referencing
-     * the <code>KeyInfo</code> from other XML structures.
-     *
-     * @param content a list of one or more {@link XMLStructure}s representing
-     *    key information types. The list is defensively copied to protect
-     *    against subsequent modification.
-     * @param id the value of an XML <code>ID</code> (may be <code>null</code>)
-     * @return a <code>KeyInfo</code>
-     * @throws NullPointerException if <code>content</code> is <code>null</code>
-     * @throws IllegalArgumentException if <code>content</code> is empty
-     * @throws ClassCastException if <code>content</code> contains any entries
-     *    that are not of type {@link XMLStructure}
-     */
-    public abstract KeyInfo newKeyInfo(List content, String id);
-
-    /**
-     * Creates a <code>KeyName</code> from the specified name.
-     *
-     * @param name the name that identifies the key
-     * @return a <code>KeyName</code>
-     * @throws NullPointerException if <code>name</code> is <code>null</code>
-     */
-    public abstract KeyName newKeyName(String name);
-
-    /**
-     * Creates a <code>KeyValue</code> from the specified public key.
-     *
-     * @param key the public key
-     * @return a <code>KeyValue</code>
-     * @throws KeyException if the <code>key</code>'s algorithm is not
-     *    recognized or supported by this <code>KeyInfoFactory</code>
-     * @throws NullPointerException if <code>key</code> is <code>null</code>
-     */
-    public abstract KeyValue newKeyValue(PublicKey key) throws KeyException;
-
-    /**
-     * Creates a <code>PGPData</code> from the specified PGP public key
-     * identifier.
-     *
-     * @param keyId a PGP public key identifier as defined in <a href=
-     *    "http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>, section 11.2.
-     *    The array is cloned to protect against subsequent modification.
-     * @return a <code>PGPData</code>
-     * @throws NullPointerException if <code>keyId</code> is <code>null</code>
-     * @throws IllegalArgumentException if the key id is not in the correct
-     *    format
-     */
-    public abstract PGPData newPGPData(byte[] keyId);
-
-    /**
-     * Creates a <code>PGPData</code> from the specified PGP public key
-     * identifier, and optional key material packet and list of external
-     * elements.
-     *
-     * @param keyId a PGP public key identifier as defined in <a href=
-     *    "http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>, section 11.2.
-     *    The array is cloned to protect against subsequent modification.
-     * @param keyPacket a PGP key material packet as defined in <a href=
-     *    "http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>, section 5.5.
-     *    The array is cloned to protect against subsequent modification. May
-     *    be <code>null</code>.
-     * @param other a list of {@link XMLStructure}s representing elements from
-     *    an external namespace. The list is defensively copied to protect
-     *    against subsequent modification. May be <code>null</code> or empty.
-     * @return a <code>PGPData</code>
-     * @throws NullPointerException if <code>keyId</code> is <code>null</code>
-     * @throws IllegalArgumentException if the <code>keyId</code> or
-     *    <code>keyPacket</code> is not in the correct format. For
-     *    <code>keyPacket</code>, the format of the packet header is
-     *    checked and the tag is verified that it is of type key material. The
-     *    contents and format of the packet body are not checked.
-     * @throws ClassCastException if <code>other</code> contains any
-     *    entries that are not of type {@link XMLStructure}
-     */
-    public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket,
-        List other);
-
-    /**
-     * Creates a <code>PGPData</code> from the specified PGP key material
-     * packet and optional list of external elements.
-     *
-     * @param keyPacket a PGP key material packet as defined in <a href=
-     *    "http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>, section 5.5.
-     *    The array is cloned to protect against subsequent modification.
-     * @param other a list of {@link XMLStructure}s representing elements from
-     *    an external namespace. The list is defensively copied to protect
-     *    against subsequent modification. May be <code>null</code> or empty.
-     * @return a <code>PGPData</code>
-     * @throws NullPointerException if <code>keyPacket</code> is
-     *    <code>null</code>
-     * @throws IllegalArgumentException if <code>keyPacket</code> is not in the
-     *    correct format. For <code>keyPacket</code>, the format of the packet
-     *    header is checked and the tag is verified that it is of type key
-     *    material. The contents and format of the packet body are not checked.
-     * @throws ClassCastException if <code>other</code> contains any
-     *    entries that are not of type {@link XMLStructure}
-     */
-    public abstract PGPData newPGPData(byte[] keyPacket, List other);
-
-    /**
-     * Creates a <code>RetrievalMethod</code> from the specified URI.
-     *
-     * @param uri the URI that identifies the <code>KeyInfo</code> information
-     *    to be retrieved
-     * @return a <code>RetrievalMethod</code>
-     * @throws NullPointerException if <code>uri</code> is <code>null</code>
-     * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
-     *    compliant
-     */
-    public abstract RetrievalMethod newRetrievalMethod(String uri);
-
-    /**
-     * Creates a <code>RetrievalMethod</code> from the specified parameters.
-     *
-     * @param uri the URI that identifies the <code>KeyInfo</code> information
-     *    to be retrieved
-     * @param type a URI that identifies the type of <code>KeyInfo</code>
-     *    information to be retrieved (may be <code>null</code>)
-     * @param transforms a list of {@link Transform}s. The list is defensively
-     *    copied to protect against subsequent modification. May be
-     *    <code>null</code> or empty.
-     * @return a <code>RetrievalMethod</code>
-     * @throws NullPointerException if <code>uri</code> is <code>null</code>
-     * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
-     *    compliant
-     * @throws ClassCastException if <code>transforms</code> contains any
-     *    entries that are not of type {@link Transform}
-     */
-    public abstract RetrievalMethod newRetrievalMethod(String uri, String type,
-        List transforms);
-
-    /**
-     * Creates a <code>X509Data</code> containing the specified list of
-     * X.509 content.
-     *
-     * @param content a list of one or more X.509 content types. Valid types are
-     *    {@link String} (subject names), <code>byte[]</code> (subject key ids),
-     *    {@link java.security.cert.X509Certificate}, {@link X509CRL},
-     *    or {@link XMLStructure} ({@link X509IssuerSerial}
-     *    objects or elements from an external namespace). Subject names are
-     *    distinguished names in RFC 2253 String format. Implementations MUST
-     *    support the attribute type keywords defined in RFC 2253 (CN, L, ST,
-     *    O, OU, C, STREET, DC and UID). Implementations MAY support additional
-     *    keywords. The list is defensively copied to protect against
-     *    subsequent modification.
-     * @return a <code>X509Data</code>
-     * @throws NullPointerException if <code>content</code> is <code>null</code>
-     * @throws IllegalArgumentException if <code>content</code> is empty, or
-     *    if a subject name is not RFC 2253 compliant or one of the attribute
-     *    type keywords is not recognized.
-     * @throws ClassCastException if <code>content</code> contains any entries
-     *    that are not of one of the valid types mentioned above
-     */
-    public abstract X509Data newX509Data(List content);
-
-    /**
-     * Creates an <code>X509IssuerSerial</code> from the specified X.500 issuer
-     * distinguished name and serial number.
-     *
-     * @param issuerName the issuer's distinguished name in RFC 2253 String
-     *    format. Implementations MUST support the attribute type keywords
-     *    defined in RFC 2253 (CN, L, ST, O, OU, C, STREET, DC and UID).
-     *    Implementations MAY support additional keywords.
-     * @param serialNumber the serial number
-     * @return an <code>X509IssuerSerial</code>
-     * @throws NullPointerException if <code>issuerName</code> or
-     *    <code>serialNumber</code> are <code>null</code>
-     * @throws IllegalArgumentException if the issuer name is not RFC 2253
-     *    compliant or one of the attribute type keywords is not recognized.
-     */
-    public abstract X509IssuerSerial newX509IssuerSerial
-        (String issuerName, BigInteger serialNumber);
-
-    /**
-     * Indicates whether a specified feature is supported.
-     *
-     * @param feature the feature name (as an absolute URI)
-     * @return <code>true</code> if the specified feature is supported,
-     *    <code>false</code> otherwise
-     * @throws NullPointerException if <code>feature</code> is <code>null</code>
-     */
-    public abstract boolean isFeatureSupported(String feature);
-
-    /**
-     * Returns a reference to the <code>URIDereferencer</code> that is used by
-     * default to dereference URIs in {@link RetrievalMethod} objects.
-     *
-     * @return a reference to the default <code>URIDereferencer</code>
-     */
-    public abstract URIDereferencer getURIDereferencer();
-
-    /**
-     * Unmarshals a new <code>KeyInfo</code> instance from a
-     * mechanism-specific <code>XMLStructure</code> (ex: {@link DOMStructure})
-     * instance.
-     *
-     * @param xmlStructure a mechanism-specific XML structure from which to
-     *   unmarshal the keyinfo from
-     * @return the <code>KeyInfo</code>
-     * @throws NullPointerException if <code>xmlStructure</code> is
-     *   <code>null</code>
-     * @throws ClassCastException if the type of <code>xmlStructure</code> is
-     *   inappropriate for this factory
-     * @throws MarshalException if an unrecoverable exception occurs during
-     *   unmarshalling
-     */
-    public abstract KeyInfo unmarshalKeyInfo(XMLStructure xmlStructure)
-        throws MarshalException;
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyName.java b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyName.java
deleted file mode 100755
index 50a17e1..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyName.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: KeyName.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
- */
-package javax.xml.crypto.dsig.keyinfo;
-
-import javax.xml.crypto.XMLStructure;
-
-/**
- * A representation of the XML <code>KeyName</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * A <code>KeyName</code> object contains a string value which may be used
- * by the signer to communicate a key identifier to the recipient. The
- * XML Schema Definition is defined as:
- *
- * <pre>
- * &lt;element name="KeyName" type="string"/&gt;
- * </pre>
- *
- * A <code>KeyName</code> instance may be created by invoking the
- * {@link KeyInfoFactory#newKeyName newKeyName} method of the
- * {@link KeyInfoFactory} class, and passing it a <code>String</code>
- * representing the name of the key; for example:
- * <pre>
- * KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
- * KeyName keyName = factory.newKeyName("Alice");
- * </pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see KeyInfoFactory#newKeyName(String)
- */
-public interface KeyName extends XMLStructure {
-
-    /**
-     * Returns the name of this <code>KeyName</code>.
-     *
-     * @return the name of this <code>KeyName</code> (never
-     *    <code>null</code>)
-     */
-    String getName();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyValue.java b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyValue.java
deleted file mode 100755
index 36bda00..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/KeyValue.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: KeyValue.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
- */
-package javax.xml.crypto.dsig.keyinfo;
-
-import java.security.KeyException;
-import java.security.KeyStore;
-import java.security.PublicKey;
-import java.security.interfaces.DSAPublicKey;
-import java.security.interfaces.RSAPublicKey;
-import javax.xml.crypto.XMLStructure;
-
-/**
- * A representation of the XML <code>KeyValue</code> element as defined
- * in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>. A
- * <code>KeyValue</code> object contains a single public key that may be
- * useful in validating the signature. The XML schema definition is defined as:
- *
- * <pre>
- *    &lt;element name="KeyValue" type="ds:KeyValueType"/&gt;
- *    &lt;complexType name="KeyValueType" mixed="true"&gt;
- *      &lt;choice&gt;
- *        &lt;element ref="ds:DSAKeyValue"/&gt;
- *        &lt;element ref="ds:RSAKeyValue"/&gt;
- *        &lt;any namespace="##other" processContents="lax"/&gt;
- *      &lt;/choice&gt;
- *    &lt;/complexType&gt;
- *
- *    &lt;element name="DSAKeyValue" type="ds:DSAKeyValueType"/&gt;
- *    &lt;complexType name="DSAKeyValueType"&gt;
- *      &lt;sequence&gt;
- *        &lt;sequence minOccurs="0"&gt;
- *          &lt;element name="P" type="ds:CryptoBinary"/&gt;
- *          &lt;element name="Q" type="ds:CryptoBinary"/&gt;
- *        &lt;/sequence&gt;
- *        &lt;element name="G" type="ds:CryptoBinary" minOccurs="0"/&gt;
- *        &lt;element name="Y" type="ds:CryptoBinary"/&gt;
- *        &lt;element name="J" type="ds:CryptoBinary" minOccurs="0"/&gt;
- *        &lt;sequence minOccurs="0"&gt;
- *          &lt;element name="Seed" type="ds:CryptoBinary"/&gt;
- *          &lt;element name="PgenCounter" type="ds:CryptoBinary"/&gt;
- *        &lt;/sequence&gt;
- *      &lt;/sequence&gt;
- *    &lt;/complexType&gt;
- *
- *    &lt;element name="RSAKeyValue" type="ds:RSAKeyValueType"/&gt;
- *    &lt;complexType name="RSAKeyValueType"&gt;
- *      &lt;sequence&gt;
- *        &lt;element name="Modulus" type="ds:CryptoBinary"/&gt;
- *        &lt;element name="Exponent" type="ds:CryptoBinary"/&gt;
- *      &lt;/sequence&gt;
- *    &lt;/complexType&gt;
- * </pre>
- * A <code>KeyValue</code> instance may be created by invoking the
- * {@link KeyInfoFactory#newKeyValue newKeyValue} method of the
- * {@link KeyInfoFactory} class, and passing it a {@link
- * java.security.PublicKey} representing the value of the public key. Here is
- * an example of creating a <code>KeyValue</code> from a {@link DSAPublicKey}
- * of a {@link java.security.cert.Certificate} stored in a
- * {@link java.security.KeyStore}:
- * <pre>
- * KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
- * PublicKey dsaPublicKey = keyStore.getCertificate("myDSASigningCert").getPublicKey();
- * KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
- * KeyValue keyValue = factory.newKeyValue(dsaPublicKey);
- * </pre>
- *
- * This class returns the <code>DSAKeyValue</code> and
- * <code>RSAKeyValue</code> elements as objects of type
- * {@link DSAPublicKey} and {@link RSAPublicKey}, respectively. Note that not
- * all of the fields in the schema are accessible as parameters of these
- * types.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see KeyInfoFactory#newKeyValue(PublicKey)
- */
-public interface KeyValue extends XMLStructure {
-
-    /**
-     * URI identifying the DSA KeyValue KeyInfo type:
-     * http://www.w3.org/2000/09/xmldsig#DSAKeyValue. This can be specified as
-     * the value of the <code>type</code> parameter of the
-     * {@link RetrievalMethod} class to describe a remote
-     * <code>DSAKeyValue</code> structure.
-     */
-    final static String DSA_TYPE =
-        "http://www.w3.org/2000/09/xmldsig#DSAKeyValue";
-
-    /**
-     * URI identifying the RSA KeyValue KeyInfo type:
-     * http://www.w3.org/2000/09/xmldsig#RSAKeyValue. This can be specified as
-     * the value of the <code>type</code> parameter of the
-     * {@link RetrievalMethod} class to describe a remote
-     * <code>RSAKeyValue</code> structure.
-     */
-    final static String RSA_TYPE =
-        "http://www.w3.org/2000/09/xmldsig#RSAKeyValue";
-
-    /**
-     * Returns the public key of this <code>KeyValue</code>.
-     *
-     * @return the public key of this <code>KeyValue</code>
-     * @throws KeyException if this <code>KeyValue</code> cannot be converted
-     *    to a <code>PublicKey</code>
-     */
-    PublicKey getPublicKey() throws KeyException;
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/PGPData.java b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/PGPData.java
deleted file mode 100755
index 917cbdd..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/PGPData.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: PGPData.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
- */
-package javax.xml.crypto.dsig.keyinfo;
-
-import java.util.Collections;
-import java.util.List;
-import javax.xml.crypto.XMLStructure;
-
-/**
- * A representation of the XML <code>PGPData</code> element as defined in
- * the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>. A
- * <code>PGPData</code> object is used to convey information related to
- * PGP public key pairs and signatures on such keys. The XML Schema Definition
- * is defined as:
- *
- * <pre>
- *    &lt;element name="PGPData" type="ds:PGPDataType"/&gt;
- *    &lt;complexType name="PGPDataType"&gt;
- *      &lt;choice&gt;
- *        &lt;sequence&gt;
- *          &lt;element name="PGPKeyID" type="base64Binary"/&gt;
- *          &lt;element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/&gt;
- *          &lt;any namespace="##other" processContents="lax" minOccurs="0"
- *           maxOccurs="unbounded"/&gt;
- *        &lt;/sequence&gt;
- *        &lt;sequence&gt;
- *          &lt;element name="PGPKeyPacket" type="base64Binary"/&gt;
- *          &lt;any namespace="##other" processContents="lax" minOccurs="0"
- *           maxOccurs="unbounded"/&gt;
- *        &lt;/sequence&gt;
- *      &lt;/choice&gt;
- *    &lt;/complexType&gt;
- * </pre>
- *
- * A <code>PGPData</code> instance may be created by invoking one of the
- * {@link KeyInfoFactory#newPGPData newPGPData} methods of the {@link
- * KeyInfoFactory} class, and passing it
- * <code>byte</code> arrays representing the contents of the PGP public key
- * identifier and/or PGP key material packet, and an optional list of
- * elements from an external namespace.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see KeyInfoFactory#newPGPData(byte[])
- * @see KeyInfoFactory#newPGPData(byte[], byte[], List)
- * @see KeyInfoFactory#newPGPData(byte[], List)
- */
-public interface PGPData extends XMLStructure {
-
-    /**
-     * URI identifying the PGPData KeyInfo type:
-     * http://www.w3.org/2000/09/xmldsig#PGPData. This can be specified as the
-     * value of the <code>type</code> parameter of the {@link RetrievalMethod}
-     * class to describe a remote <code>PGPData</code> structure.
-     */
-    final static String TYPE = "http://www.w3.org/2000/09/xmldsig#PGPData";
-
-    /**
-     * Returns the PGP public key identifier of this <code>PGPData</code> as
-     * defined in <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>,
-     * section 11.2.
-     *
-     * @return the PGP public key identifier (may be <code>null</code> if
-     *    not specified). Each invocation of this method returns a new clone
-     *    to protect against subsequent modification.
-     */
-    byte[] getKeyId();
-
-    /**
-     * Returns the PGP key material packet of this <code>PGPData</code> as
-     * defined in <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>,
-     * section 5.5.
-     *
-     * @return the PGP key material packet (may be <code>null</code> if not
-     *    specified). Each invocation of this method returns a new clone to
-     *    protect against subsequent modification.
-     */
-    byte[] getKeyPacket();
-
-    /**
-     * Returns an {@link Collections#unmodifiableList unmodifiable list}
-     * of {@link XMLStructure}s representing elements from an external
-     * namespace.
-     *
-     * @return an unmodifiable list of <code>XMLStructure</code>s (may be
-     *    empty, but never <code>null</code>)
-     */
-    List getExternalElements();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java
deleted file mode 100755
index bffbe1a..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: RetrievalMethod.java,v 1.8 2005/05/10 16:35:35 mullan Exp $
- */
-package javax.xml.crypto.dsig.keyinfo;
-
-import javax.xml.crypto.Data;
-import javax.xml.crypto.URIReference;
-import javax.xml.crypto.URIReferenceException;
-import javax.xml.crypto.XMLCryptoContext;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dsig.Transform;
-import java.util.List;
-
-/**
- * A representation of the XML <code>RetrievalMethod</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * A <code>RetrievalMethod</code> object is used to convey a reference to
- * <code>KeyInfo</code> information that is stored at another location.
- * The XML schema definition is defined as:
- *
- * <pre>
- *   &lt;element name="RetrievalMethod" type="ds:RetrievalMethodType"/&gt;
- *   &lt;complexType name="RetrievalMethodType"&gt;
- *     &lt;sequence&gt;
- *       &lt;element name="Transforms" type="ds:TransformsType" minOccurs="0"/&gt;
- *     &lt;/sequence&gt;
- *     &lt;attribute name="URI" type="anyURI"/&gt;
- *     &lt;attribute name="Type" type="anyURI" use="optional"/&gt;
- *   &lt;/complexType&gt;
- * </pre>
- *
- * A <code>RetrievalMethod</code> instance may be created by invoking one of the
- * {@link KeyInfoFactory#newRetrievalMethod newRetrievalMethod} methods
- * of the {@link KeyInfoFactory} class, and passing it the URI
- * identifying the location of the KeyInfo, an optional type URI identifying
- * the type of KeyInfo, and an optional list of {@link Transform}s; for example:
- * <pre>
- *   KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
- *   RetrievalMethod rm = factory.newRetrievalMethod
- *      ("#KeyValue-1", KeyValue.DSA_TYPE, Collections.singletonList(Transform.BASE64));
- * </pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see KeyInfoFactory#newRetrievalMethod(String)
- * @see KeyInfoFactory#newRetrievalMethod(String, String, List)
- */
-public interface RetrievalMethod extends URIReference, XMLStructure {
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} of {@link Transform}s of this <code>RetrievalMethod</code>.
-     *
-     * @return an unmodifiable list of <code>Transform</code> objects (may be
-     *    empty but never <code>null</code>).
-     */
-    List getTransforms();
-
-    /**
-     * Returns the URI of the referenced <code>KeyInfo</code> information.
-     *
-     * @return the URI of the referenced <code>KeyInfo</code> information in
-     *    RFC 2396 format (never <code>null</code>)
-     */
-    String getURI();
-
-   /**
-    * Dereferences the <code>KeyInfo</code> information referenced by this
-    * <code>RetrievalMethod</code> and applies the specified
-    * <code>Transform</code>s.
-    *
-    * @param context an <code>XMLCryptoContext</code> that may contain
-    *    additional useful information for dereferencing the URI. The
-    *    context's <code>baseURI</code> and <code>dereferencer</code>
-    *    parameters (if specified) are used to resolve and dereference this
-    *    <code>RetrievalMethod</code>
-    * @return a <code>Data</code> object representing the raw contents of the
-    *    <code>KeyInfo</code> information referenced by this
-    *    <code>RetrievalMethod</code>. It is the caller's responsibility to
-    *    convert the returned data to an appropriate
-    *    <code>KeyInfo</code> object.
-    * @throws NullPointerException if <code>context</code> is <code>null</code>
-    * @throws URIReferenceException if there is an error while dereferencing
-    */
-    Data dereference(XMLCryptoContext context) throws URIReferenceException;
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/X509Data.java b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/X509Data.java
deleted file mode 100755
index 88d6961..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/X509Data.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: X509Data.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
- */
-package javax.xml.crypto.dsig.keyinfo;
-
-import javax.xml.crypto.XMLStructure;
-import java.security.cert.X509CRL;
-import java.util.List;
-
-/**
- * A representation of the XML <code>X509Data</code> element as defined in
- * the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>. An
- * <code>X509Data</code> object contains one or more identifers of keys
- * or X.509 certificates (or certificates' identifiers or a revocation list).
- * The XML Schema Definition is defined as:
- *
- * <pre>
- *    &lt;element name="X509Data" type="ds:X509DataType"/&gt;
- *    &lt;complexType name="X509DataType"&gt;
- *        &lt;sequence maxOccurs="unbounded"&gt;
- *          &lt;choice&gt;
- *            &lt;element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/&gt;
- *            &lt;element name="X509SKI" type="base64Binary"/&gt;
- *            &lt;element name="X509SubjectName" type="string"/&gt;
- *            &lt;element name="X509Certificate" type="base64Binary"/&gt;
- *            &lt;element name="X509CRL" type="base64Binary"/&gt;
- *            &lt;any namespace="##other" processContents="lax"/&gt;
- *          &lt;/choice&gt;
- *        &lt;/sequence&gt;
- *    &lt;/complexType&gt;
- *
- *    &lt;complexType name="X509IssuerSerialType"&gt;
- *      &lt;sequence&gt;
- *        &lt;element name="X509IssuerName" type="string"/&gt;
- *        &lt;element name="X509SerialNumber" type="integer"/&gt;
- *      &lt;/sequence&gt;
- *    &lt;/complexType&gt;
- * </pre>
- *
- * An <code>X509Data</code> instance may be created by invoking the
- * {@link KeyInfoFactory#newX509Data newX509Data} methods of the
- * {@link KeyInfoFactory} class and passing it a list of one or more
- * {@link XMLStructure}s representing X.509 content; for example:
- * <pre>
- *   KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
- *   X509Data x509Data = factory.newX509Data
- *       (Collections.singletonList("cn=Alice"));
- * </pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see KeyInfoFactory#newX509Data(List)
- */
-//@@@ check for illegal combinations of data violating MUSTs in W3c spec
-public interface X509Data extends XMLStructure {
-
-    /**
-     * URI identifying the X509Data KeyInfo type:
-     * http://www.w3.org/2000/09/xmldsig#X509Data. This can be specified as
-     * the value of the <code>type</code> parameter of the
-     * {@link RetrievalMethod} class to describe a remote
-     * <code>X509Data</code> structure.
-     */
-    final static String TYPE = "http://www.w3.org/2000/09/xmldsig#X509Data";
-
-    /**
-     * URI identifying the binary (ASN.1 DER) X.509 Certificate KeyInfo type:
-     * http://www.w3.org/2000/09/xmldsig#rawX509Certificate. This can be
-     * specified as the value of the <code>type</code> parameter of the
-     * {@link RetrievalMethod} class to describe a remote X509 Certificate.
-     */
-    final static String RAW_X509_CERTIFICATE_TYPE =
-        "http://www.w3.org/2000/09/xmldsig#rawX509Certificate";
-
-    /**
-     * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
-     * list} of the content in this <code>X509Data</code>. Valid types are
-     * {@link String} (subject names), <code>byte[]</code> (subject key ids),
-     * {@link java.security.cert.X509Certificate}, {@link X509CRL},
-     * or {@link XMLStructure} ({@link X509IssuerSerial}
-     * objects or elements from an external namespace).
-     *
-     * @return an unmodifiable list of the content in this <code>X509Data</code>
-     *    (never <code>null</code> or empty)
-     */
-    List getContent();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/X509IssuerSerial.java b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/X509IssuerSerial.java
deleted file mode 100755
index 91ab769..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/X509IssuerSerial.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: X509IssuerSerial.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
- */
-package javax.xml.crypto.dsig.keyinfo;
-
-import java.math.BigInteger;
-import java.security.cert.X509Certificate;
-import javax.xml.crypto.XMLStructure;
-
-/**
- * A representation of the XML <code>X509IssuerSerial</code> element as
- * defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
- * W3C Recommendation for XML-Signature Syntax and Processing</a>.
- * An <code>X509IssuerSerial</code> object contains an X.509 issuer
- * distinguished name (DN) and serial number pair. The XML schema definition is
- * defined as:
- *
- * <pre>
- *   &lt;element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/&gt;
- *   &lt;complexType name="X509IssuerSerialType"&gt;
- *     &lt;sequence&gt;
- *       &lt;element name="X509IssuerName" type="string"/&gt;
- *       &lt;element name="X509SerialNumber" type="integer"/&gt;
- *     &lt;/sequence&gt;
- *   &lt;/complexType&gt;
- * </pre>
- *
- * An <code>X509IssuerSerial</code> instance may be created by invoking the
- * {@link KeyInfoFactory#newX509IssuerSerial newX509IssuerSerial} method
- * of the {@link KeyInfoFactory} class, and passing it a
- * <code>String</code> and <code>BigInteger</code> representing the X.500
- * DN and serial number. Here is an example of creating an
- * <code>X509IssuerSerial</code> from the issuer DN and serial number of an
- * existing {@link X509Certificate}:
- * <pre>
- * KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
- * X509IssuerSerial issuer = factory.newX509IssuerSerial
- *     (cert.getIssuerX500Principal().getName(), cert.getSerialNumber());
- * </pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see X509Data#getContent
- * @see KeyInfoFactory#newX509IssuerSerial(String, BigInteger)
- */
-public interface X509IssuerSerial extends XMLStructure {
-
-    /**
-     * Returns the X.500 distinguished name of this
-     * <code>X509IssuerSerial</code> in
-     * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> String format.
-     *
-     * @return the X.500 distinguished name in RFC 2253 String format (never
-     *    <code>null</code>)
-     */
-    String getIssuerName();
-
-    /**
-     * Returns the serial number of this <code>X509IssuerSerial</code>.
-     *
-     * @return the serial number (never <code>null</code>)
-     */
-    BigInteger getSerialNumber();
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/package.html b/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/package.html
deleted file mode 100755
index c97c98f..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/keyinfo/package.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body>
-Classes for parsing and processing {@link javax.xml.crypto.dsig.keyinfo.KeyInfo 
-KeyInfo} elements and structures. <code>KeyInfo</code> is an optional element
-that enables the recipient(s) to obtain the key needed to validate an 
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature}. <code>KeyInfo</code> 
-may contain keys, names, certificates and other public key management 
-information, such as in-band key distribution or key agreement data. This 
-package contains classes representing types defined in the W3C specification 
-for XML Signatures, such as 
-{@link javax.xml.crypto.dsig.keyinfo.KeyName KeyName},
-{@link javax.xml.crypto.dsig.keyinfo.KeyValue KeyValue},
-{@link javax.xml.crypto.dsig.keyinfo.RetrievalMethod RetrievalMethod},
-{@link javax.xml.crypto.dsig.keyinfo.X509Data X509Data},
-{@link javax.xml.crypto.dsig.keyinfo.X509IssuerSerial X509IssuerSerial}, and
-{@link javax.xml.crypto.dsig.keyinfo.PGPData PGPData}.
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory}
-is an abstract factory that creates <code>KeyInfo</code> objects from scratch.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-<p>
-<dl>
-<dt><b>Since:</b></dt>
-  <dd>1.6</dd>
-</dl>
-
-</body>
-</html>
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/package.html b/ojluni/src/main/java/javax/xml/crypto/dsig/package.html
deleted file mode 100755
index 2ba62e5..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/package.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body>
-Classes for generating and validating XML digital
-signatures. This package includes classes that represent the core elements 
-defined in the W3C XML digital signature specification:
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature},
-{@link javax.xml.crypto.dsig.SignedInfo SignedInfo},
-{@link javax.xml.crypto.dsig.CanonicalizationMethod CanonicalizationMethod},
-{@link javax.xml.crypto.dsig.SignatureMethod SignatureMethod},
-{@link javax.xml.crypto.dsig.Reference Reference}, 
-{@link javax.xml.crypto.dsig.DigestMethod DigestMethod},
-{@link javax.xml.crypto.dsig.XMLObject XMLObject}, 
-{@link javax.xml.crypto.dsig.Manifest Manifest},
-{@link javax.xml.crypto.dsig.SignatureProperties SignatureProperties}, and
-{@link javax.xml.crypto.dsig.SignatureProperty SignatureProperty}. 
-<code>KeyInfo</code> types
-are defined in the {@link javax.xml.crypto.dsig.keyinfo} subpackage.
-{@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory}
-is an abstract factory that creates 
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature} objects from scratch
-or from a pre-existing XML representation, such as a DOM node.
-{@link javax.xml.crypto.dsig.TransformService} is a service provider
-interface for creating and plugging in implementations of
-transform and canonicalization algorithms.
-
-<p>Of primary significance in this package is the 
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature} class,
-which allows you to sign and validate an XML digital signature.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-<p>
-<dl>
-<dt><b>Since:</b></dt>
-  <dd>1.6</dd>
-</dl>
-
-</body>
-</html>
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/C14NMethodParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/C14NMethodParameterSpec.java
deleted file mode 100755
index 48778ac..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/C14NMethodParameterSpec.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: C14NMethodParameterSpec.java,v 1.3 2005/05/10 16:40:17 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import javax.xml.crypto.dsig.CanonicalizationMethod;
-
-/**
- * A specification of algorithm parameters for a {@link CanonicalizationMethod}
- * Algorithm. The purpose of this interface is to group (and provide type
- * safety for) all canonicalization (C14N) parameter specifications. All
- * canonicalization parameter specifications must implement this interface.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see CanonicalizationMethod
- */
-public interface C14NMethodParameterSpec extends TransformParameterSpec {}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/DigestMethodParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/DigestMethodParameterSpec.java
deleted file mode 100755
index 5fe1fd7..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/DigestMethodParameterSpec.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: DigestMethodParameterSpec.java,v 1.3 2005/05/10 16:40:17 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import javax.xml.crypto.dsig.DigestMethod;
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A specification of algorithm parameters for a {@link DigestMethod}
- * algorithm. The purpose of this interface is to group (and provide type
- * safety for) all digest method parameter specifications. All digest method
- * parameter specifications must implement this interface.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see DigestMethod
- */
-public interface DigestMethodParameterSpec extends AlgorithmParameterSpec {}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java
deleted file mode 100755
index af07c1f..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: ExcC14NParameterSpec.java,v 1.7 2005/05/13 18:45:42 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import javax.xml.crypto.dsig.CanonicalizationMethod;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Parameters for the W3C Recommendation:
- * <a href="http://www.w3.org/TR/xml-exc-c14n/">
- * Exclusive XML Canonicalization (C14N) algorithm</a>. The
- * parameters include an optional inclusive namespace prefix list. The XML
- * Schema Definition of the Exclusive XML Canonicalization parameters is
- * defined as:
- * <pre><code>
- * &lt;schema xmlns="http://www.w3.org/2001/XMLSchema"
- *         xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"
- *         targetNamespace="http://www.w3.org/2001/10/xml-exc-c14n#"
- *         version="0.1" elementFormDefault="qualified"&gt;
- *
- * &lt;element name="InclusiveNamespaces" type="ec:InclusiveNamespaces"/&gt;
- * &lt;complexType name="InclusiveNamespaces"&gt;
- *   &lt;attribute name="PrefixList" type="xsd:string"/&gt;
- * &lt;/complexType&gt;
- * &lt;/schema&gt;
- * </code></pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see CanonicalizationMethod
- */
-public final class ExcC14NParameterSpec implements C14NMethodParameterSpec {
-
-    private List preList;
-
-    /**
-     * Indicates the default namespace ("#default").
-     */
-    public static final String DEFAULT = "#default";
-
-    /**
-     * Creates a <code>ExcC14NParameterSpec</code> with an empty prefix
-     * list.
-     */
-    public ExcC14NParameterSpec() {
-        preList = Collections.EMPTY_LIST;
-    }
-
-    /**
-     * Creates a <code>ExcC14NParameterSpec</code> with the specified list
-     * of prefixes. The list is copied to protect against subsequent
-     * modification.
-     *
-     * @param prefixList the inclusive namespace prefix list. Each entry in
-     *    the list is a <code>String</code> that represents a namespace prefix.
-     * @throws NullPointerException if <code>prefixList</code> is
-     *    <code>null</code>
-     * @throws ClassCastException if any of the entries in the list are not
-     *    of type <code>String</code>
-     */
-    public ExcC14NParameterSpec(List prefixList) {
-        if (prefixList == null) {
-            throw new NullPointerException("prefixList cannot be null");
-        }
-        this.preList = new ArrayList(prefixList);
-        for (int i = 0, size = preList.size(); i < size; i++) {
-            if (!(preList.get(i) instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-        preList = Collections.unmodifiableList(preList);
-    }
-
-    /**
-     * Returns the inclusive namespace prefix list. Each entry in the list
-     * is a <code>String</code> that represents a namespace prefix.
-     *
-     * <p>This implementation returns an {@link
-     * java.util.Collections#unmodifiableList unmodifiable list}.
-     *
-     * @return the inclusive namespace prefix list (may be empty but never
-     *    <code>null</code>)
-     */
-    public List getPrefixList() {
-        return preList;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/HMACParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/HMACParameterSpec.java
deleted file mode 100755
index 3685099..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/HMACParameterSpec.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: HMACParameterSpec.java,v 1.4 2005/05/10 16:40:17 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import javax.xml.crypto.dsig.SignatureMethod;
-
-/**
- * Parameters for the <a href="http://www.w3.org/TR/xmldsig-core/#sec-MACs">
- * XML Signature HMAC Algorithm</a>. The parameters include an optional output
- * length which specifies the MAC truncation length in bits. The resulting
- * HMAC will be truncated to the specified number of bits. If the parameter is
- * not specified, then this implies that all the bits of the hash are to be
- * output. The XML Schema Definition of the <code>HMACOutputLength</code>
- * element is defined as:
- * <pre><code>
- * &lt;element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/&gt;
- * &lt;simpleType name="HMACOutputLengthType"&gt;
- *   &lt;restriction base="integer"/&gt;
- * &lt;/simpleType&gt;
- * </code></pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see SignatureMethod
- * @see <a href="http://www.ietf.org/rfc/rfc2104.txt">RFC 2104</a>
- */
-public final class HMACParameterSpec implements SignatureMethodParameterSpec {
-
-    private int outputLength;
-
-    /**
-     * Creates an <code>HMACParameterSpec</code> with the specified truncation
-     * length.
-     *
-     * @param outputLength the truncation length in number of bits
-     */
-    public HMACParameterSpec(int outputLength) {
-        this.outputLength = outputLength;
-    }
-
-    /**
-     * Returns the truncation length.
-     *
-     * @return the truncation length in number of bits
-     */
-    public int getOutputLength() {
-        return outputLength;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/SignatureMethodParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/SignatureMethodParameterSpec.java
deleted file mode 100755
index e5aeff6..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/SignatureMethodParameterSpec.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: SignatureMethodParameterSpec.java,v 1.3 2005/05/10 16:40:17 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import javax.xml.crypto.dsig.SignatureMethod;
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A specification of algorithm parameters for an XML {@link SignatureMethod}
- * algorithm. The purpose of this interface is to group (and provide type
- * safety for) all signature method parameter specifications. All signature
- * method parameter specifications must implement this interface.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see SignatureMethod
- */
-public interface SignatureMethodParameterSpec extends AlgorithmParameterSpec {}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/TransformParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/TransformParameterSpec.java
deleted file mode 100755
index 78d8b7c..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/TransformParameterSpec.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: TransformParameterSpec.java,v 1.3 2005/05/10 16:40:17 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import javax.xml.crypto.dsig.Transform;
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * A specification of algorithm parameters for a {@link Transform}
- * algorithm. The purpose of this interface is to group (and provide type
- * safety for) all transform parameter specifications. All transform parameter
- * specifications must implement this interface.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see Transform
- */
-public interface TransformParameterSpec extends AlgorithmParameterSpec {}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java
deleted file mode 100755
index 35854ab..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XPathFilter2ParameterSpec.java,v 1.7 2005/05/13 18:45:42 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.crypto.dsig.Transform;
-
-/**
- * Parameters for the W3C Recommendation
- * <a href="http://www.w3.org/TR/xmldsig-filter2/">
- * XPath Filter 2.0 Transform Algorithm</a>.
- * The parameters include a list of one or more {@link XPathType} objects.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see Transform
- * @see XPathFilterParameterSpec
- */
-public final class XPathFilter2ParameterSpec implements TransformParameterSpec {
-
-    private final List xPathList;
-
-    /**
-     * Creates an <code>XPathFilter2ParameterSpec</code>.
-     *
-     * @param xPathList a list of one or more {@link XPathType} objects. The
-     *    list is defensively copied to protect against subsequent modification.
-     * @throws ClassCastException if <code>xPathList</code> contains any
-     *    entries that are not of type {@link XPathType}
-     * @throws IllegalArgumentException if <code>xPathList</code> is empty
-     * @throws NullPointerException if <code>xPathList</code> is
-     *    <code>null</code>
-     */
-    public XPathFilter2ParameterSpec(List xPathList) {
-        if (xPathList == null) {
-            throw new NullPointerException("xPathList cannot be null");
-        }
-        List xPathListCopy = new ArrayList(xPathList);
-        if (xPathListCopy.isEmpty()) {
-            throw new IllegalArgumentException("xPathList cannot be empty");
-        }
-        int size = xPathListCopy.size();
-        for (int i = 0; i < size; i++) {
-            if (!(xPathListCopy.get(i) instanceof XPathType)) {
-                throw new ClassCastException
-                    ("xPathList["+i+"] is not a valid type");
-            }
-        }
-        this.xPathList = Collections.unmodifiableList(xPathListCopy);
-    }
-
-    /**
-     * Returns a list of one or more {@link XPathType} objects.
-     * <p>
-     * This implementation returns an {@link Collections#unmodifiableList
-     * unmodifiable list}.
-     *
-     * @return a <code>List</code> of <code>XPathType</code> objects
-     *    (never <code>null</code> or empty)
-     */
-    public List getXPathList() {
-        return xPathList;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java
deleted file mode 100755
index 486bf27..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XPathFilterParameterSpec.java,v 1.4 2005/05/10 16:40:17 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import javax.xml.crypto.dsig.Transform;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * Parameters for the <a href="http://www.w3.org/TR/xmldsig-core/#sec-XPath">
- * XPath Filtering Transform Algorithm</a>.
- * The parameters include the XPath expression and an optional <code>Map</code>
- * of additional namespace prefix mappings. The XML Schema Definition of
- * the XPath Filtering transform parameters is defined as:
- * <pre><code>
- * &lt;element name="XPath" type="string"/&gt;
- * </code></pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see Transform
- */
-public final class XPathFilterParameterSpec implements TransformParameterSpec {
-
-    private String xPath;
-    private Map nsMap;
-
-    /**
-     * Creates an <code>XPathFilterParameterSpec</code> with the specified
-     * XPath expression.
-     *
-     * @param xPath the XPath expression to be evaluated
-     * @throws NullPointerException if <code>xPath</code> is <code>null</code>
-     */
-    public XPathFilterParameterSpec(String xPath) {
-        if (xPath == null) {
-            throw new NullPointerException();
-        }
-        this.xPath = xPath;
-        this.nsMap = Collections.EMPTY_MAP;
-    }
-
-    /**
-     * Creates an <code>XPathFilterParameterSpec</code> with the specified
-     * XPath expression and namespace map. The map is copied to protect against
-     * subsequent modification.
-     *
-     * @param xPath the XPath expression to be evaluated
-     * @param namespaceMap the map of namespace prefixes. Each key is a
-     *    namespace prefix <code>String</code> that maps to a corresponding
-     *    namespace URI <code>String</code>.
-     * @throws NullPointerException if <code>xPath</code> or
-     *    <code>namespaceMap</code> are <code>null</code>
-     * @throws ClassCastException if any of the map's keys or entries are not
-     *    of type <code>String</code>
-     */
-    public XPathFilterParameterSpec(String xPath, Map namespaceMap) {
-        if (xPath == null || namespaceMap == null) {
-            throw new NullPointerException();
-        }
-        this.xPath = xPath;
-        nsMap = new HashMap(namespaceMap);
-        Iterator entries = nsMap.entrySet().iterator();
-        while (entries.hasNext()) {
-            Map.Entry me = (Map.Entry) entries.next();
-            if (!(me.getKey() instanceof String) ||
-                !(me.getValue() instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-        nsMap = Collections.unmodifiableMap(nsMap);
-    }
-
-    /**
-     * Returns the XPath expression to be evaluated.
-     *
-     * @return the XPath expression to be evaluated
-     */
-    public String getXPath() {
-        return xPath;
-    }
-
-    /**
-     * Returns a map of namespace prefixes. Each key is a namespace prefix
-     * <code>String</code> that maps to a corresponding namespace URI
-     * <code>String</code>.
-     * <p>
-     * This implementation returns an {@link Collections#unmodifiableMap
-     * unmodifiable map}.
-     *
-     * @return a <code>Map</code> of namespace prefixes to namespace URIs (may
-     *    be empty, but never <code>null</code>)
-     */
-    public Map getNamespaceMap() {
-        return nsMap;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathType.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathType.java
deleted file mode 100755
index 8ad417c..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XPathType.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XPathType.java,v 1.4 2005/05/10 16:40:17 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The XML Schema Definition of the <code>XPath</code> element as defined in the
- * <a href="http://www.w3.org/TR/xmldsig-filter2">
- * W3C Recommendation for XML-Signature XPath Filter 2.0</a>:
- * <pre><code>
- * &lt;schema xmlns="http://www.w3.org/2001/XMLSchema"
- *         xmlns:xf="http://www.w3.org/2002/06/xmldsig-filter2"
- *         targetNamespace="http://www.w3.org/2002/06/xmldsig-filter2"
- *         version="0.1" elementFormDefault="qualified"&gt;
- *
- * &lt;element name="XPath"
- *          type="xf:XPathType"/&gt;
- *
- * &lt;complexType name="XPathType"&gt;
- *   &lt;simpleContent&gt;
- *     &lt;extension base="string"&gt;
- *       &lt;attribute name="Filter"&gt;
- *         &lt;simpleType&gt;
- *           &lt;restriction base="string"&gt;
- *             &lt;enumeration value="intersect"/&gt;
- *             &lt;enumeration value="subtract"/&gt;
- *             &lt;enumeration value="union"/&gt;
- *           &lt;/restriction&gt;
- *         &lt;/simpleType&gt;
- *       &lt;/attribute&gt;
- *     &lt;/extension&gt;
- *   &lt;/simpleContent&gt;
- * &lt;/complexType&gt;
- * </code></pre>
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see XPathFilter2ParameterSpec
- */
-public class XPathType {
-
-    /**
-     * Represents the filter set operation.
-     */
-    public static class Filter {
-        private final String operation;
-
-        private Filter(String operation) {
-            this.operation = operation;
-        }
-
-        /**
-         * Returns the string form of the operation.
-         *
-         * @return the string form of the operation
-         */
-        public String toString() {
-            return operation;
-        }
-
-        /**
-         * The intersect filter operation.
-         */
-        public static final Filter INTERSECT = new Filter("intersect");
-
-        /**
-         * The subtract filter operation.
-         */
-        public static final Filter SUBTRACT = new Filter("subtract");
-
-        /**
-         * The union filter operation.
-         */
-        public static final Filter UNION = new Filter("union");
-    }
-
-    private final String expression;
-    private final Filter filter;
-    private Map nsMap;
-
-    /**
-     * Creates an <code>XPathType</code> instance with the specified XPath
-     * expression and filter.
-     *
-     * @param expression the XPath expression to be evaluated
-     * @param filter the filter operation ({@link Filter#INTERSECT},
-     *    {@link Filter#SUBTRACT}, or {@link Filter#UNION})
-     * @throws NullPointerException if <code>expression</code> or
-     *    <code>filter</code> is <code>null</code>
-     */
-    public XPathType(String expression, Filter filter) {
-        if (expression == null) {
-            throw new NullPointerException("expression cannot be null");
-        }
-        if (filter == null) {
-            throw new NullPointerException("filter cannot be null");
-        }
-        this.expression = expression;
-        this.filter = filter;
-        this.nsMap = Collections.EMPTY_MAP;
-    }
-
-    /**
-     * Creates an <code>XPathType</code> instance with the specified XPath
-     * expression, filter, and namespace map. The map is copied to protect
-     * against subsequent modification.
-     *
-     * @param expression the XPath expression to be evaluated
-     * @param filter the filter operation ({@link Filter#INTERSECT},
-     *    {@link Filter#SUBTRACT}, or {@link Filter#UNION})
-     * @param namespaceMap the map of namespace prefixes. Each key is a
-     *    namespace prefix <code>String</code> that maps to a corresponding
-     *    namespace URI <code>String</code>.
-     * @throws NullPointerException if <code>expression</code>,
-     *    <code>filter</code> or <code>namespaceMap</code> are
-     *    <code>null</code>
-     * @throws ClassCastException if any of the map's keys or entries are
-     *    not of type <code>String</code>
-     */
-    public XPathType(String expression, Filter filter, Map namespaceMap) {
-        this(expression, filter);
-        if (namespaceMap == null) {
-            throw new NullPointerException("namespaceMap cannot be null");
-        }
-        nsMap = new HashMap(namespaceMap);
-        Iterator entries = nsMap.entrySet().iterator();
-        while (entries.hasNext()) {
-            Map.Entry me = (Map.Entry) entries.next();
-            if (!(me.getKey() instanceof String) ||
-                !(me.getValue() instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-        nsMap = Collections.unmodifiableMap(nsMap);
-    }
-
-    /**
-     * Returns the XPath expression to be evaluated.
-     *
-     * @return the XPath expression to be evaluated
-     */
-    public String getExpression() {
-        return expression;
-    }
-
-    /**
-     * Returns the filter operation.
-     *
-     * @return the filter operation
-     */
-    public Filter getFilter() {
-        return filter;
-    }
-
-    /**
-     * Returns a map of namespace prefixes. Each key is a namespace prefix
-     * <code>String</code> that maps to a corresponding namespace URI
-     * <code>String</code>.
-     * <p>
-     * This implementation returns an {@link Collections#unmodifiableMap
-     * unmodifiable map}.
-     *
-     * @return a <code>Map</code> of namespace prefixes to namespace URIs
-     *    (may be empty, but never <code>null</code>)
-     */
-    public Map getNamespaceMap() {
-        return nsMap;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XSLTTransformParameterSpec.java b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XSLTTransformParameterSpec.java
deleted file mode 100755
index 6a05b77..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/XSLTTransformParameterSpec.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * $Id: XSLTTransformParameterSpec.java,v 1.4 2005/05/10 16:40:18 mullan Exp $
- */
-package javax.xml.crypto.dsig.spec;
-
-import javax.xml.crypto.dsig.Transform;
-import javax.xml.crypto.XMLStructure;
-
-/**
- * Parameters for the <a href="http://www.w3.org/TR/1999/REC-xslt-19991116">
- * XSLT Transform Algorithm</a>.
- * The parameters include a namespace-qualified stylesheet element.
- *
- * <p>An <code>XSLTTransformParameterSpec</code> is instantiated with a
- * mechanism-dependent (ex: DOM) stylesheet element. For example:
- * <pre>
- *   DOMStructure stylesheet = new DOMStructure(element)
- *   XSLTTransformParameterSpec spec = new XSLTransformParameterSpec(stylesheet);
- * </pre>
- * where <code>element</code> is an {@link org.w3c.dom.Element} containing
- * the namespace-qualified stylesheet element.
- *
- * @author Sean Mullan
- * @author JSR 105 Expert Group
- * @since 1.6
- * @see Transform
- */
-public final class XSLTTransformParameterSpec implements TransformParameterSpec{
-    private XMLStructure stylesheet;
-
-    /**
-     * Creates an <code>XSLTTransformParameterSpec</code> with the specified
-     * stylesheet.
-     *
-     * @param stylesheet the XSLT stylesheet to be used
-     * @throws NullPointerException if <code>stylesheet</code> is
-     *    <code>null</code>
-     */
-    public XSLTTransformParameterSpec(XMLStructure stylesheet) {
-        if (stylesheet == null) {
-            throw new NullPointerException();
-        }
-        this.stylesheet = stylesheet;
-    }
-
-    /**
-     * Returns the stylesheet.
-     *
-     * @return the stylesheet
-     */
-    public XMLStructure getStylesheet() {
-        return stylesheet;
-    }
-}
diff --git a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/package.html b/ojluni/src/main/java/javax/xml/crypto/dsig/spec/package.html
deleted file mode 100755
index b528957..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/dsig/spec/package.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body>
-Parameter classes for XML digital signatures. This package
-contains interfaces and classes representing input parameters for the
-digest, signature, transform, or canonicalization algorithms used in
-the processing of XML signatures. 
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-<li>
-<a href="http://www.w3.org/TR/xml-exc-c14n/">
-Exclusive XML Canonicalization algorithm: W3C Recommendation</a>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-filter2/">
-XPath Filter 2.0 Transform Algorithm: W3C Recommendation</a>
-</ul>
-
-<p>
-<dl>
-<dt><b>Since:</b></dt>
-  <dd>1.6</dd>
-</dl>
-
-</body>
-</html>
diff --git a/ojluni/src/main/java/javax/xml/crypto/package.html b/ojluni/src/main/java/javax/xml/crypto/package.html
deleted file mode 100755
index e5fc99e..0000000
--- a/ojluni/src/main/java/javax/xml/crypto/package.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body>
-Common classes for XML cryptography. This package includes common classes that 
-are used to perform XML cryptographic operations, such as generating
-an XML signature or encrypting XML data. 
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-<p>
-<dl>
-<dt><b>Since:</b></dt>
-  <dd>1.6</dd>
-</dl>
-
-</body>
-</html>