Index: src/test/java/tests/api/java/math/BigIntegerTest.java =================================================================== --- src/test/java/tests/api/java/math/BigIntegerTest.java (revision 490030) +++ src/test/java/tests/api/java/math/BigIntegerTest.java (working copy) @@ -275,9 +275,9 @@ * @tests java.math.BigInteger#valueOf(long) */ public void test_valueOfJ() { - assertTrue("Incorred number returned for 2", BigInteger.valueOf(2L) + assertTrue("Incurred number returned for 2", BigInteger.valueOf(2L) .equals(two)); - assertTrue("Incorred number returned for 200", BigInteger.valueOf(200L) + assertTrue("Incurred number returned for 200", BigInteger.valueOf(200L) .equals(BigInteger.valueOf(139).add(BigInteger.valueOf(61)))); } Index: src/test/java/tests/api/java/math/BigDecimalTest.java =================================================================== --- src/test/java/tests/api/java/math/BigDecimalTest.java (revision 490030) +++ src/test/java/tests/api/java/math/BigDecimalTest.java (working copy) @@ -591,7 +591,7 @@ BigDecimal setScale2 = setScale1.setScale(4); assertTrue("the number 2.323E102 after setting scale is wrong", setScale2.scale() == 4); - assertTrue("the resentation of the number 2.323E102 is wrong", + assertTrue("the representation of the number 2.323E102 is wrong", setScale2.doubleValue() == 2.323E102); setScale1 = new BigDecimal("-1.253E-12"); setScale2 = setScale1.setScale(17, BigDecimal.ROUND_CEILING); Index: src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java =================================================================== --- src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java (revision 490030) +++ src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java (working copy) @@ -84,7 +84,7 @@ } /** - * Divide two equal in absolute value numbers of different signes. + * Divide two equal in absolute value numbers of different signs. */ public void testCase4() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127}; Index: src/main/java/java/math/BigInteger.java =================================================================== --- src/main/java/java/math/BigInteger.java (revision 490030) +++ src/main/java/java/math/BigInteger.java (working copy) @@ -209,7 +209,7 @@ /** * Constructs a number without to create new space. - * This constrcut should be used only if the three fields + * This construct should be used only if the three fields * of representation are known. * @param sign the sign of the number * @param numberLength the length of the internal array Index: src/main/java/java/math/BigDecimal.java =================================================================== --- src/main/java/java/math/BigDecimal.java (revision 490030) +++ src/main/java/java/math/BigDecimal.java (working copy) @@ -182,7 +182,7 @@ LONG_TEN_POW_BIT_LENGTH[j] = bitLength(LONG_TEN_POW[j]); } - // Taking the references of usefull powers. + // Taking the references of useful powers. TEN_POW = Multiplication.bigTenPows; FIVE_POW = Multiplication.bigFivePows; } @@ -247,7 +247,7 @@ offset++; begin++; } - // Acumulating all digits until a possible decimal point + // Accumulating all digits until a possible decimal point for (; (offset <= last) && (in[offset] != '.') && (in[offset] != 'e') && (in[offset] != 'E'); offset++) { ; @@ -256,7 +256,7 @@ // A decimal point was found if ((offset <= last) && (in[offset] == '.')) { offset++; - // Acumulating all digits until a possible exponent + // Accumulating all digits until a possible exponent begin = offset; for (; (offset <= last) && (in[offset] != 'e') && (in[offset] != 'E'); offset++) { @@ -270,7 +270,7 @@ // An exponent was found if ((offset <= last) && ((in[offset] == 'e') || (in[offset] == 'E'))) { offset++; - // Checking for a posible sign of scale + // Checking for a possible sign of scale begin = offset; if ((offset <= last) && (in[offset] == '+')) { offset++; @@ -278,7 +278,7 @@ begin++; } } - // Acumulating all reminaining digits + // Accumulating all remaining digits scaleString = String.valueOf(in, begin, last + 1 - begin); // Checking if the scale is defined newScale = (long)scale - Integer.parseInt(scaleString); @@ -601,7 +601,7 @@ tempBI = Multiplication.multiplyByPositiveInt(tempBI, 10) .add(BigInteger.valueOf(thisSignum * 9)); } - // Rounding the improved substracting + // Rounding the improved subtracting leftOperand = new BigDecimal(tempBI, this.scale + 1); return leftOperand.round(mc); } @@ -887,7 +887,7 @@ if ((divisor.aproxPrecision() + newScale > this.aproxPrecision() + 1L) || (this.isZero())) { /* If the divisor's integer part is greater than this's integer part, - * the result must be zero with the apropriate scale */ + * the result must be zero with the appropriate scale */ integralValue = BigInteger.ZERO; } else if (newScale == 0) { integralValue = getUnscaledValue().divide( divisor.getUnscaledValue() ); @@ -898,7 +898,7 @@ } else {// (newScale < 0) powerOfTen = Multiplication.powerOf10(-newScale); integralValue = getUnscaledValue().multiply(powerOfTen).divide( divisor.getUnscaledValue() ); - // To strip trailing zeros aproximating to the preferred scale + // To strip trailing zeros approximating to the preferred scale while (!integralValue.testBit(0)) { quotAndRem = integralValue.divideAndRemainder(TEN_POW[i]); if ((quotAndRem[1].signum() == 0) @@ -950,7 +950,7 @@ // To calculate: (u1 / (u2 * 10^(s1-s2)) * 10^newScale quotAndRem[0] = quotAndRem[0].multiply(Multiplication.powerOf10(newScale)); } else {// CASE s2 > s1: - /* To calculate the minimus power of ten, such that the quotient + /* To calculate the minimum power of ten, such that the quotient * (u1 * 10^exp) / u2 has at least 'mc.precision()' digits. */ long exp = Math.min(-diffScale, Math.max((long)mcPrecision - diffPrecision, 0)); long compRemDiv; @@ -1215,7 +1215,7 @@ return new BigDecimal(Multiplication.multiplyByTenPow(getUnscaledValue(),(int)diffScale), newScale); } // diffScale < 0 - // return [u,s] / [1,newScale] with the apropiate scale and rounding + // return [u,s] / [1,newScale] with the appropriate scale and rounding if(this.bitLength < 64 && -diffScale < LONG_TEN_POW.length) { return dividePrimitiveLongs(this.smallValue, LONG_TEN_POW[(int)-diffScale], newScale,roundingMode); } @@ -1724,7 +1724,7 @@ private void inplaceRound(MathContext mc) { int mcPrecision = mc.getPrecision(); int discardedPrecision = precision() - mcPrecision; - // If no rounding is necessary it returns inmediatly + // If no rounding is necessary it returns immediately if ((discardedPrecision <= 0) || (mcPrecision == 0)) { return; } @@ -1733,7 +1733,7 @@ smallRound(mc, discardedPrecision); return; } - // Getting the interger part and the discarded fraction + // Getting the integer part and the discarded fraction BigInteger sizeOfFraction = Multiplication.powerOf10(discardedPrecision); BigInteger[] integerAndFraction = getUnscaledValue().divideAndRemainder(sizeOfFraction); long newScale = (long)scale - discardedPrecision; @@ -1757,7 +1757,7 @@ newScale--; } } - // To update all inernal fields + // To update all internal fields scale = toIntScale(newScale); precision = mcPrecision; setUnscaledValue(integerAndFraction[0]); @@ -1777,7 +1777,7 @@ long sizeOfFraction = LONG_TEN_POW[discardedPrecision]; long newScale = (long)scale - discardedPrecision; long unscaledVal = smallValue; - // Getting the interger part and the discarded fraction + // Getting the integer part and the discarded fraction long integer = unscaledVal / sizeOfFraction; long fraction = unscaledVal % sizeOfFraction; int compRem; @@ -1795,7 +1795,7 @@ newScale--; } } - // To update all inernal fields + // To update all internal fields scale = toIntScale(newScale); precision = mc.getPrecision(); smallValue = integer; @@ -1806,7 +1806,7 @@ /** * Return an increment that can be -1,0 or 1, depending of roundingMode. * @param parityBit can be 0 or 1, it's only used in the case HALF_EVEN. - * @param fraction the mantisa to be analized. + * @param fraction the mantisa to be analyzed. * @param roundingMode the type of rounding. * @return the carry propagated after rounding. */ @@ -1876,11 +1876,11 @@ } /** - * If the precion already was calculated it returns that value, otherwise - * it calculates a very good aproximization efficiently . Note that this + * If the precision already was calculated it returns that value, otherwise + * it calculates a very good approximation efficiently . Note that this * value will be precision() or precision()-1 * in the worst case. - * @return an aproximization of precision() value + * @return an approximation of precision() value */ private int aproxPrecision() { return ((precision > 0) @@ -1911,7 +1911,7 @@ } /** - * It returns the value 0 with the most aproximated scale of type + * It returns the value 0 with the most approximated scale of type * int. if longScale > Integer.MAX_VALUE * the scale will be Integer.MAX_VALUE; if * longScale < Integer.MIN_VALUE the scale will be Index: src/main/java/java/math/Division.java =================================================================== --- src/main/java/java/math/Division.java (revision 490030) +++ src/main/java/java/math/Division.java (working copy) @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -303,7 +303,7 @@ } /** - * Computes the quotient and the remainder after a divison by an {@code int} + * Computes the quotient and the remainder after a division by an {@code int} * number. * * @return an array of the form {@code [quotient, remainder]}. @@ -343,7 +343,7 @@ } /** - * Multipies an array by int and subtracts it from a subarray of another + * Multiplies an array by int and subtracts it from a subarray of another * array. * * @param a the array to subtract from @@ -451,9 +451,9 @@ * type. * * @param op1 - * a postive number + * a positive number * @param op2 - * a postive number + * a positive number * @see #gcdBinary(BigInteger, BigInteger) * @return GCD(op1, op2) */ @@ -486,7 +486,7 @@ /** * Calculates a.modInverse(p) Based on: Savas, E; Koc, C "The Montgomery Modular - * Inverse - Revisted" + * Inverse - Revised" */ static BigInteger modInverseMontgomery(BigInteger a, BigInteger p) { @@ -576,7 +576,7 @@ r.sign = 1; while (v.signum() > 0) { - // INV v >= 0, u >= 0, v odd, u odd (excepto last iteration when v is even (0)) + // INV v >= 0, u >= 0, v odd, u odd (except last iteration when v is even (0)) while (u.compareTo(v) > BigInteger.EQUALS) { Elementary.inplaceSubtract(u, v); @@ -681,7 +681,7 @@ int k; while (!isPowerOfTwo(u, coefU) && !isPowerOfTwo(v, coefV)) { - // modification of orignal algorithm: I calculate how many times the algorithm will enter in the same branch of if + // modification of original algorithm: I calculate how many times the algorithm will enter in the same branch of if k = howManyIterations(u, n); if (k != 0) { @@ -815,7 +815,7 @@ /** * Performs modular exponentiation using the Montgomery Reduction. It - * requires that all parameters be postivive and the mudulus be odd. > + * requires that all parameters be positive and the modulus be odd. > * * @see BigInteger#modPow(BigInteger, BigInteger) * @see #monPro(BigInteger, BigInteger, BigInteger, long) @@ -858,7 +858,7 @@ /** * Performs modular exponentiation using the Montgomery Reduction. It - * requires that all parameters be postivive and the mudulus be even. Based + * requires that all parameters be positive and the modulus be even. Based * The square and multiply algorithm and the Montgomery Reduction C. K. * Koc - Montgomery Reduction with Even Modulus. The square and * multiply algorithm and the Montgomery Reduction. @@ -891,7 +891,7 @@ } /** - * It requires that all parameters be postivive. + * It requires that all parameters be positive. * * @return {@code baseexponent mod (2j)}. * @see BigInteger#modPow(BigInteger, BigInteger) @@ -997,12 +997,12 @@ /** * Implements the Montgomery Product of two integers represented by - * {@code int} arrays. The arrays are suposed in little + * {@code int} arrays. The arrays are supposed in little * endian notation. * * @param a The first factor of the product. * @param b The second factor of the product. - * @param modulus The modululus of the oprations. Zmodulus. + * @param modulus The modulus of the operations. Zmodulus. * @param n2 The digit modulus'[0]. * @ar.org.fitc.ref "C. K. Koc - Analyzing and Comparing Montgomery * Multiplication Algorithms" Index: src/main/java/java/math/Conversion.java =================================================================== --- src/main/java/java/math/Conversion.java (revision 490030) +++ src/main/java/java/math/Conversion.java (working copy) @@ -234,7 +234,7 @@ // +7 - For "special case 2" (see below) we have 7 free chars for // inserting necessary scaled digits. result = new char[resLengthInChars + 1]; - // alocated [resLengthInChars+1] charactes. + // allocated [resLengthInChars+1] characters. // a free latest character may be used for "special case 1" (see // below) currentChar = resLengthInChars; Index: src/main/java/java/math/Elementary.java =================================================================== --- src/main/java/java/math/Elementary.java (revision 490030) +++ src/main/java/java/math/Elementary.java (working copy) @@ -245,7 +245,7 @@ * the result (i.e. {@code op1.bitLength() >= op2.bitLength()}). Both * should be positive (i.e. {@code op1 >= op2}). * - * @param op1 the input minuend, and the ouput result. + * @param op1 the input minuend, and the output result. * @param op2 the addend */ static void inplaceAdd(BigInteger op1, BigInteger op2) { @@ -293,7 +293,7 @@ * should be positive (what implies that {@code op1 >= op2}). * * @param op1 - * the input minuend, and the ouput result. + * the input minuend, and the output result. * @param op2 * the subtrahend */ Index: src/main/java/java/math/Logical.java =================================================================== --- src/main/java/java/math/Logical.java (revision 490030) +++ src/main/java/java/math/Logical.java (working copy) @@ -273,7 +273,7 @@ return result; } - /** @return sign = 1, magniutde = positive.magnitude & ~(-negative.magnitude)*/ + /** @return sign = 1, magnitude = positive.magnitude & ~(-negative.magnitude)*/ static BigInteger andNotPositiveNegative(BigInteger positive, BigInteger negative) { // PRE: positive > 0 && negative < 0 int iNeg = negative.getFirstNonzeroDigit(); @@ -528,7 +528,7 @@ /** @return sign = -1, magnitude = -(positive.magnitude | -negative.magnitude) */ static BigInteger orDiffSigns(BigInteger positive, BigInteger negative){ - // Jumping over the least significative zero bits + // Jumping over the least significant zero bits int iNeg = negative.getFirstNonzeroDigit(); int iPos = positive.getFirstNonzeroDigit(); int i; @@ -748,7 +748,7 @@ resDigits[i] = -1; } for ( ; i < negative.numberLength; i++) { - //resDigits[i] = ~(~negative.digts[i] ^ 0) + //resDigits[i] = ~(~negative.digits[i] ^ 0) resDigits[i] = negative.digits[i]; } } @@ -791,7 +791,7 @@ resDigits[i] = positive.digits[i]; } for ( ; i < negative.numberLength; i++) { - // resDidigts[i] = ~(0 ^ ~negative.digits[i]) + // resDigits[i] = ~(0 ^ ~negative.digits[i]) resDigits[i] = negative.digits[i]; } Index: src/main/java/java/math/Primality.java =================================================================== --- src/main/java/java/math/Primality.java (revision 490030) +++ src/main/java/java/math/Primality.java (working copy) @@ -83,7 +83,7 @@ /** * It uses the sieve of Eratosthenes to discard several composite numbers in - * some appropiate range (at the moment {@code [this, this + 1024]}). After + * some appropriate range (at the moment {@code [this, this + 1024]}). After * this process it applies the Miller-Rabin test to the numbers that were * not discarded in the sieve. * @@ -108,7 +108,7 @@ return BIprimes[i]; } /* - * Creates a "N" enough big to hold the next probale prime Note that: N < + * Creates a "N" enough big to hold the next probable prime Note that: N < * "next prime" < 2*N */ startPoint = new BigInteger(1, n.numberLength, @@ -130,7 +130,7 @@ modules[i] = Division.remainder(startPoint, primes[i]) - gapSize; } while (true) { - // At this point, all numbers in the gap are initializated as + // At this point, all numbers in the gap are initialized as // probably primes Arrays.fill(isDivisible, false); // To discard multiples of first primes @@ -234,7 +234,7 @@ * * @param n the input number to be tested. * @param t the number of trials. - * @return {@code false} if the number is definitily compose, otherwise + * @return {@code false} if the number is definitely compose, otherwise * {@code true} with probability {@code 1 - 4(-t)}. * @ar.org.fitc.ref "D. Knuth, The Art of Computer Programming Vo.2, Section * 4.5.4., Algorithm P" Index: src/main/java/java/math/RoundingMode.java =================================================================== --- src/main/java/java/math/RoundingMode.java (revision 490030) +++ src/main/java/java/math/RoundingMode.java (working copy) @@ -52,7 +52,7 @@ /** The old constant of BigDecimal. */ protected final int bigDecimalRM; - /** It sets the old contant. */ + /** It sets the old constant. */ RoundingMode(int rm) { bigDecimalRM = rm; } Index: src/main/java/java/math/Multiplication.java =================================================================== --- src/main/java/java/math/Multiplication.java (revision 490030) +++ src/main/java/java/math/Multiplication.java (working copy) @@ -54,7 +54,7 @@ }; /** - * An array with the fisrt powers of ten in {@code BigInteger} version. + * An array with the first powers of ten in {@code BigInteger} version. * ({@code 10^0,10^1,...,10^31}) */ static final BigInteger[] bigTenPows = new BigInteger[32];