--- old/src/java.base/share/classes/java/math/BigInteger.java 2018-09-28 11:28:51.137908797 +0700 +++ new/src/java.base/share/classes/java/math/BigInteger.java 2018-09-28 11:28:50.725908797 +0700 @@ -629,7 +629,7 @@ // bitsPerDigit in the given radix times 1024 // Rounded up to avoid underallocation. - private static long bitsPerDigit[] = { 0, 0, + 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, @@ -780,7 +780,7 @@ */ private static BigInteger smallPrime(int bitLength, int certainty, Random rnd) { int magLen = (bitLength + 31) >>> 5; - int temp[] = new int[magLen]; + 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 @@ -1209,7 +1209,7 @@ * 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[]) { + private static BigInteger valueOf(int[] val) { return (val[0] > 0 ? new BigInteger(val, 1) : new BigInteger(val)); } @@ -1219,8 +1219,8 @@ * Initialize static constant array when class is loaded. */ private static final int MAX_CONSTANT = 16; - private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1]; - private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1]; + private static BigInteger[] posConst = new BigInteger[MAX_CONSTANT+1]; + private static BigInteger[] negConst = new BigInteger[MAX_CONSTANT+1]; /** * The cache of powers of each radix. This allows us to not have to @@ -1375,7 +1375,7 @@ result[--xIndex] = x[xIndex]; // Grow result if necessary if (carry) { - int bigger[] = new int[result.length + 1]; + int[] bigger = new int[result.length + 1]; System.arraycopy(result, 0, bigger, 1, result.length); bigger[0] = 0x01; return bigger; @@ -1398,7 +1398,7 @@ int xIndex = x.length; int yIndex = y.length; - int result[] = new int[xIndex]; + int[] result = new int[xIndex]; long sum = 0; if (yIndex == 1) { sum = (x[--xIndex] & LONG_MASK) + (y[0] & LONG_MASK) ; @@ -1422,7 +1422,7 @@ // Grow result if necessary if (carry) { - int bigger[] = new int[result.length + 1]; + int[] bigger = new int[result.length + 1]; System.arraycopy(result, 0, bigger, 1, result.length); bigger[0] = 0x01; return bigger; @@ -1433,11 +1433,11 @@ private static int[] subtract(long val, int[] little) { int highWord = (int)(val >>> 32); if (highWord == 0) { - int result[] = new int[1]; + int[] result = new int[1]; result[0] = (int)(val - (little[0] & LONG_MASK)); return result; } else { - int result[] = new int[2]; + int[] result = new int[2]; if (little.length == 1) { long difference = ((int)val & LONG_MASK) - (little[0] & LONG_MASK); result[1] = (int)difference; @@ -1469,7 +1469,7 @@ private static int[] subtract(int[] big, long val) { int highWord = (int)(val >>> 32); int bigIndex = big.length; - int result[] = new int[bigIndex]; + int[] result = new int[bigIndex]; long difference = 0; if (highWord == 0) { @@ -1525,7 +1525,7 @@ */ private static int[] subtract(int[] big, int[] little) { int bigIndex = big.length; - int result[] = new int[bigIndex]; + int[] result = new int[bigIndex]; int littleIndex = little.length; long difference = 0; @@ -1890,7 +1890,7 @@ return this.abs(); } - int intSlice[] = new int[sliceSize]; + int[] intSlice = new int[sliceSize]; System.arraycopy(mag, start, intSlice, 0, sliceSize); return new BigInteger(trustedStripLeadingZeroInts(intSlice), 1); @@ -1947,7 +1947,7 @@ return abs(); } - int lowerInts[] = new int[n]; + int[] lowerInts = new int[n]; System.arraycopy(mag, len-n, lowerInts, 0, n); return new BigInteger(trustedStripLeadingZeroInts(lowerInts), 1); @@ -1966,7 +1966,7 @@ } int upperLen = len - n; - int upperInts[] = new int[upperLen]; + int[] upperInts = new int[upperLen]; System.arraycopy(mag, 0, upperInts, 0, upperLen); return new BigInteger(trustedStripLeadingZeroInts(upperInts), 1); @@ -2508,12 +2508,12 @@ return a; } else { // Array must be resized if (nBits <= (32-bitsInHighWord)) { - int result[] = new int[nInts+len]; + int[] result = new int[nInts+len]; System.arraycopy(a, 0, result, 0, len); primitiveLeftShift(result, result.length, nBits); return result; } else { - int result[] = new int[nInts+len+1]; + int[] result = new int[nInts+len+1]; System.arraycopy(a, 0, result, 0, len); primitiveRightShift(result, result.length, 32 - nBits); return result; @@ -3240,7 +3240,7 @@ int nInts = n >>> 5; int nBits = n & 0x1f; int magLen = mag.length; - int newMag[] = null; + int[] newMag = null; if (nBits == 0) { newMag = new int[magLen + nInts]; @@ -3299,7 +3299,7 @@ int nInts = n >>> 5; int nBits = n & 0x1f; int magLen = mag.length; - int newMag[] = null; + int[] newMag = null; // Special case: entire contents shifted off the end if (nInts >= magLen) @@ -3864,7 +3864,7 @@ // Compute upper bound on number of digit groups and allocate space int maxNumDigitGroups = (4*mag.length + 6)/7; - String digitGroup[] = new String[maxNumDigitGroups]; + String[] digitGroup = new String[maxNumDigitGroups]; // Translate number to string, a digit group at a time BigInteger tmp = this.abs(); @@ -3981,7 +3981,7 @@ } /* zero[i] is a string of i consecutive zeros. */ - private static String zeros[] = new String[64]; + private static String[] zeros = new String[64]; static { zeros[63] = "000000000000000000000000000000000000000000000000000000000000000"; @@ -4263,7 +4263,7 @@ /** * Returns a copy of the input array stripped of any leading zero bytes. */ - private static int[] stripLeadingZeroInts(int val[]) { + private static int[] stripLeadingZeroInts(int[] val) { int vlen = val.length; int keep; @@ -4277,7 +4277,7 @@ * 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[]) { + private static int[] trustedStripLeadingZeroInts(int[] val) { int vlen = val.length; int keep; @@ -4290,7 +4290,7 @@ /** * Returns a copy of the input array stripped of any leading zero bytes. */ - private static int[] stripLeadingZeroBytes(byte a[], int off, int len) { + private static int[] stripLeadingZeroBytes(byte[] a, int off, int len) { int indexBound = off + len; int keep; @@ -4316,7 +4316,7 @@ * 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 off, int len) { + private static int[] makePositive(byte[] a, int off, int len) { int keep, k; int indexBound = off + len; @@ -4332,7 +4332,7 @@ int extraByte = (k == indexBound) ? 1 : 0; int intLength = ((indexBound - keep + extraByte) + 3) >>> 2; - int result[] = new int[intLength]; + int[] result = new int[intLength]; /* Copy one's complement of input into output, leaving extra * byte (if it exists) == 0x00 */ @@ -4364,7 +4364,7 @@ * 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[]) { + private static int[] makePositive(int[] a) { int keep, j; // Find first non-sign (0xffffffff) int of input @@ -4376,7 +4376,7 @@ 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]; + int[] result = new int[a.length - keep + extraInt]; /* Copy one's complement of input into output, leaving extra * int (if it exists) == 0x00 */ @@ -4401,11 +4401,11 @@ * nonsense values in their 0 and 1 elements, as radixes 0 and 1 are not * used. */ - private static int digitsPerLong[] = {0, 0, + 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, + private static BigInteger[] longRadix = {null, null, valueOf(0x4000000000000000L), valueOf(0x383d9170b85ff80bL), valueOf(0x4000000000000000L), valueOf(0x6765c793fa10079dL), valueOf(0x41c21cb8e1000000L), valueOf(0x3642798750226111L), @@ -4428,11 +4428,11 @@ /* * These two arrays are the integer analogue of above. */ - private static int digitsPerInt[] = {0, 0, 30, 19, 15, 13, 11, + 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, + private static int[] intRadix = {0, 0, 0x40000000, 0x4546b3db, 0x40000000, 0x48c27395, 0x159fd800, 0x75db9c97, 0x40000000, 0x17179149, 0x3b9aca00, 0xcc6db61, 0x19a10000, 0x309f1021, 0x57f6c100, 0xa2f1b6f, 0x10000000,