/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
/*
* @test
* @bug 6880672 6896573 6899694 6976036 7013585 7018258
* @summary Exercise Arrays.sort
* @build Sorting
* @run main Sorting -shortrun
*
* @author Vladimir Yaroslavskiy
* @author Jon Bentley
* @author Josh Bloch
*/
public class Sorting {
// Array lengths used in a long run (default)
private static final int[] LONG_RUN_LENGTHS = {
1, 2, 3, 5, 8, 13, 21, 34, 55, 100, 1000, 10000, 100000, 1000000 };
// Array lengths used in a short run
private static final int[] SHORT_RUN_LENGTHS = {
1, 2, 3, 21, 55, 1000, 10000 };
// Random initial values used in a long run (default)
// Random initial values used in a short run
if (shortRun) {
} else {
}
}
}
}
}
}
private static void testEmptyAndNullIntArray() {
ourDescription = "Check empty and null array";
try {
} catch (NullPointerException expected) {
try {
} catch (NullPointerException expected2) {
return;
}
failed("Arrays.sort(int[],fromIndex,toIndex) shouldn't " +
"catch null array");
}
failed("Arrays.sort(int[]) shouldn't catch null array");
}
private static void testEmptyAndNullLongArray() {
ourDescription = "Check empty and null array";
try {
} catch (NullPointerException expected) {
try {
} catch (NullPointerException expected2) {
return;
}
failed("Arrays.sort(long[],fromIndex,toIndex) shouldn't " +
"catch null array");
}
failed("Arrays.sort(long[]) shouldn't catch null array");
}
private static void testEmptyAndNullShortArray() {
ourDescription = "Check empty and null array";
try {
} catch (NullPointerException expected) {
try {
} catch (NullPointerException expected2) {
return;
}
failed("Arrays.sort(short[],fromIndex,toIndex) shouldn't " +
"catch null array");
}
failed("Arrays.sort(short[]) shouldn't catch null array");
}
private static void testEmptyAndNullCharArray() {
ourDescription = "Check empty and null array";
try {
} catch (NullPointerException expected) {
try {
} catch (NullPointerException expected2) {
return;
}
failed("Arrays.sort(char[],fromIndex,toIndex) shouldn't " +
"catch null array");
}
failed("Arrays.sort(char[]) shouldn't catch null array");
}
private static void testEmptyAndNullByteArray() {
ourDescription = "Check empty and null array";
try {
} catch (NullPointerException expected) {
try {
} catch (NullPointerException expected2) {
return;
}
failed("Arrays.sort(byte[],fromIndex,toIndex) shouldn't " +
"catch null array");
}
failed("Arrays.sort(byte[]) shouldn't catch null array");
}
private static void testEmptyAndNullFloatArray() {
ourDescription = "Check empty and null array";
try {
} catch (NullPointerException expected) {
try {
} catch (NullPointerException expected2) {
return;
}
failed("Arrays.sort(float[],fromIndex,toIndex) shouldn't " +
"catch null array");
}
failed("Arrays.sort(float[]) shouldn't catch null array");
}
private static void testEmptyAndNullDoubleArray() {
ourDescription = "Check empty and null array";
try {
} catch (NullPointerException expected) {
try {
} catch (NullPointerException expected2) {
return;
}
failed("Arrays.sort(double[],fromIndex,toIndex) shouldn't " +
"catch null array");
}
failed("Arrays.sort(double[]) shouldn't catch null array");
}
ourDescription = "Check sorting of subarray";
boolean newLine = false;
newLine = true;
int fromIndex = m;
}
}
if (newLine) {
}
}
ourDescription = "Check range check";
for (int i = 1; i <= length; i++) {
golden[i - 1] = i % m + m % i;
}
}
}
}
ourDescription = "Check if sorting is stable";
", length = " + length);
checkSorted(a);
checkStable(a);
}
}
}
}
}
failed("Sorting is not stable at position " + i +
}
}
}
for (int i = 0; i < a.length; ) {
}
return a;
}
}
int getKey() {
return myKey;
}
int getValue() {
return myValue;
}
return -1;
}
return 1;
}
return 0;
}
}
private int myKey;
private int myValue;
}
if (length > 1000) {
return;
}
ourDescription = "Check sorting with insertion sort";
}
}
}
}
if (length < 1000) {
return;
}
ourDescription = "Check merge sorting";
}
}
}
}
ourDescription = "Check sorting with check sum";
}
}
}
}
ourDescription = "Check sorting with scrambling";
for (int m = 1; m <= 7; m++) {
if (m > length) {
break;
}
}
}
}
}
ourDescription = "Check float sorting";
final int MAX = 10;
boolean newLine = false;
for (int a = 0; a <= MAX; a++) {
for (int g = 0; g <= MAX; g++) {
for (int z = 0; z <= MAX; z++) {
for (int n = 0; n <= MAX; n++) {
for (int p = 0; p <= MAX; p++) {
if (a + g + z + n + p > length) {
continue;
}
if (a + g + z + n + p < length) {
continue;
}
g + ", z = " + z + ", n = " + n + ", p = " + p);
}
newLine = true;
}
}
}
}
}
if (newLine) {
}
}
ourDescription = "Check double sorting";
final int MAX = 10;
boolean newLine = false;
for (int a = 0; a <= MAX; a++) {
for (int g = 0; g <= MAX; g++) {
for (int z = 0; z <= MAX; z++) {
for (int n = 0; n <= MAX; n++) {
for (int p = 0; p <= MAX; p++) {
if (a + g + z + n + p > length) {
continue;
}
if (a + g + z + n + p < length) {
continue;
}
g + ", z = " + z + ", n = " + n + ", p = " + p);
}
newLine = true;
}
}
}
}
}
if (newLine) {
}
}
for (int i = 0; i < fromIndex; i++) {
a[i] = 0xDEDA;
}
int k = 0;
a[i] = k++;
}
a[i] = k--;
}
a[i] = 0xBABA;
}
}
}
}
}
}
}
}
private static void swap(int[] a, int i, int j) {
int t = a[i];
a[i] = a[j];
a[j] = t;
}
private static void swap(float[] a, int i, int j) {
float t = a[i];
a[i] = a[j];
a[j] = t;
}
private static void swap(double[] a, int i, int j) {
double t = a[i];
a[i] = a[j];
a[j] = t;
}
private static enum TypeConverter {
INT {
return a.clone();
}
},
LONG {
long[] b = new long[a.length];
for (int i = 0; i < a.length; i++) {
b[i] = (long) a[i];
}
return b;
}
},
BYTE {
byte[] b = new byte[a.length];
for (int i = 0; i < a.length; i++) {
b[i] = (byte) a[i];
}
return b;
}
},
SHORT {
short[] b = new short[a.length];
for (int i = 0; i < a.length; i++) {
b[i] = (short) a[i];
}
return b;
}
},
CHAR {
char[] b = new char[a.length];
for (int i = 0; i < a.length; i++) {
b[i] = (char) a[i];
}
return b;
}
},
FLOAT {
float[] b = new float[a.length];
for (int i = 0; i < a.length; i++) {
b[i] = (float) a[i];
}
return b;
}
},
DOUBLE {
double[] b = new double[a.length];
for (int i = 0; i < a.length; i++) {
b[i] = (double) a[i];
}
return b;
}
},
INTEGER {
for (int i = 0; i < a.length; i++) {
b[i] = new Integer(a[i]);
}
return b;
}
};
name += " ";
}
return name;
}
}
private static enum FloatBuilder {
SIMPLE {
int fromIndex = 0;
fromIndex += n;
fromIndex += g;
fromIndex += z;
fromIndex += p;
}
};
}
private static enum DoubleBuilder {
SIMPLE {
int fromIndex = 0;
fromIndex += n;
fromIndex += g;
fromIndex += z;
fromIndex += p;
}
};
}
a[i] = value;
}
}
if (a[i] == a[i]) {
}
}
}
}
if (a[i] != b[i]) {
}
}
}
a[i] = value;
}
}
if (a[i] == a[i]) {
}
}
}
}
if (a[i] != b[i]) {
}
}
}
private static enum SortedBuilder {
REPEATED {
void build(int[] a, int m) {
int i = 0;
int k = 0;
while (true) {
for (int t = 1; t <= period; t++) {
if (i >= a.length) {
return;
}
a[i++] = k;
}
if (i >= a.length) {
return;
}
k++;
}
}
},
void build(int[] a, int m) {
int i = 0;
int k = m;
while (true) {
for (int t = 1; t <= m; t++) {
if (i >= a.length) {
return;
}
a[i++] = k;
}
}
}
};
abstract void build(int[] a, int m);
name += " ";
}
return name;
}
}
private static enum MergeBuilder {
void build(int[] a, int m) {
int v = 1, i = 0;
for (int k = 0; k < m; k++) {
v = 1;
for (int p = 0; p < period; p++) {
a[i++] = v++;
}
}
for (int j = i; j < a.length - 1; j++) {
a[j] = v++;
}
}
},
void build(int[] a, int m) {
int v = -1, i = 0;
for (int k = 0; k < m; k++) {
v = -1;
for (int p = 0; p < period; p++) {
a[i++] = v--;
}
}
for (int j = i; j < a.length - 1; j++) {
a[j] = v--;
}
}
};
abstract void build(int[] a, int m);
name += " ";
}
return name;
}
}
private static enum UnsortedBuilder {
RANDOM {
for (int i = 0; i < a.length; i++) {
}
}
},
for (int i = 0; i < a.length; i++) {
a[i] = m + i;
}
}
},
for (int i = 0; i < a.length; i++) {
a[i] = a.length - m - i;
}
}
},
for (int i = 0; i < a.length; i++) {
a[i] = m;
}
}
},
SAW {
int incCount = 1;
int i = 0;
int period = m--;
while (true) {
for (int k = 1; k <= period; k++) {
if (i >= a.length) {
return;
}
a[i++] = incCount++;
}
period += m;
for (int k = 1; k <= period; k++) {
if (i >= a.length) {
return;
}
a[i++] = decCount--;
}
period += m;
}
}
},
REPEATED {
for (int i = 0; i < a.length; i++) {
a[i] = i % m;
}
}
},
for (int i = 0; i < a.length; i++) {
}
}
},
for (int i = 0; i < middle; i++) {
a[i] = i;
}
a[i] = a.length - i - 1;
}
}
},
STAGGER {
for (int i = 0; i < a.length; i++) {
a[i] = (i * m + i) % a.length;
}
}
},
PLATEAU {
for (int i = 0; i < a.length; i++) {
}
}
},
SHUFFLE {
int x = 0, y = 0;
for (int i = 0; i < a.length; i++) {
}
}
};
name += " ";
}
return name;
}
}
}
throw new RuntimeException("Test failed - see log file for details");
}
}
}
if (test instanceof int[]) {
} else if (test instanceof long[]) {
} else if (test instanceof short[]) {
} else if (test instanceof byte[]) {
} else if (test instanceof char[]) {
} else if (test instanceof float[]) {
} else if (test instanceof double[]) {
} else {
}
}
private static void compare(int[] a, int[] b) {
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
}
}
}
private static void compare(long[] a, long[] b) {
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
}
}
}
private static void compare(short[] a, short[] b) {
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
}
}
}
private static void compare(byte[] a, byte[] b) {
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
}
}
}
private static void compare(char[] a, char[] b) {
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
}
}
}
private static void compare(float[] a, float[] b) {
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
}
}
}
private static void compare(double[] a, double[] b) {
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
}
}
}
for (int i = 0; i < a.length; i++) {
if (a[i].compareTo(b[i]) != 0) {
}
}
}
if (object instanceof int[]) {
checkSorted((int[]) object);
} else if (object instanceof long[]) {
checkSorted((long[]) object);
} else if (object instanceof short[]) {
checkSorted((short[]) object);
} else if (object instanceof byte[]) {
checkSorted((byte[]) object);
} else if (object instanceof char[]) {
checkSorted((char[]) object);
} else if (object instanceof float[]) {
checkSorted((float[]) object);
} else if (object instanceof double[]) {
checkSorted((double[]) object);
} else {
}
}
private static void checkSorted(int[] a) {
if (a[i] > a[i + 1]) {
}
}
}
private static void checkSorted(long[] a) {
if (a[i] > a[i + 1]) {
}
}
}
private static void checkSorted(short[] a) {
if (a[i] > a[i + 1]) {
}
}
}
private static void checkSorted(byte[] a) {
if (a[i] > a[i + 1]) {
}
}
}
private static void checkSorted(char[] a) {
if (a[i] > a[i + 1]) {
}
}
}
private static void checkSorted(float[] a) {
if (a[i] > a[i + 1]) {
}
}
}
private static void checkSorted(double[] a) {
if (a[i] > a[i + 1]) {
}
}
}
}
}
}
failed("Original and sorted arrays are not identical [xor]");
}
failed("Original and sorted arrays are not identical [plus]");
}
}
if (object instanceof int[]) {
return checkSumXor((int[]) object);
} else if (object instanceof long[]) {
return checkSumXor((long[]) object);
} else if (object instanceof short[]) {
return checkSumXor((short[]) object);
} else if (object instanceof byte[]) {
return checkSumXor((byte[]) object);
} else if (object instanceof char[]) {
return checkSumXor((char[]) object);
} else if (object instanceof float[]) {
return checkSumXor((float[]) object);
} else if (object instanceof double[]) {
return checkSumXor((double[]) object);
} else {
return -1;
}
}
int checkSum = 0;
for (Integer e : a) {
}
return checkSum;
}
private static int checkSumXor(int[] a) {
int checkSum = 0;
for (int e : a) {
checkSum ^= e;
}
return checkSum;
}
private static int checkSumXor(long[] a) {
long checkSum = 0;
for (long e : a) {
checkSum ^= e;
}
return (int) checkSum;
}
private static int checkSumXor(short[] a) {
short checkSum = 0;
for (short e : a) {
checkSum ^= e;
}
return (int) checkSum;
}
private static int checkSumXor(byte[] a) {
byte checkSum = 0;
for (byte e : a) {
checkSum ^= e;
}
return (int) checkSum;
}
private static int checkSumXor(char[] a) {
char checkSum = 0;
for (char e : a) {
checkSum ^= e;
}
return (int) checkSum;
}
private static int checkSumXor(float[] a) {
int checkSum = 0;
for (float e : a) {
checkSum ^= (int) e;
}
return checkSum;
}
private static int checkSumXor(double[] a) {
int checkSum = 0;
for (double e : a) {
checkSum ^= (int) e;
}
return checkSum;
}
if (object instanceof int[]) {
return checkSumPlus((int[]) object);
} else if (object instanceof long[]) {
return checkSumPlus((long[]) object);
} else if (object instanceof short[]) {
return checkSumPlus((short[]) object);
} else if (object instanceof byte[]) {
return checkSumPlus((byte[]) object);
} else if (object instanceof char[]) {
return checkSumPlus((char[]) object);
} else if (object instanceof float[]) {
return checkSumPlus((float[]) object);
} else if (object instanceof double[]) {
return checkSumPlus((double[]) object);
} else {
return -1;
}
}
private static int checkSumPlus(int[] a) {
int checkSum = 0;
for (int e : a) {
checkSum += e;
}
return checkSum;
}
private static int checkSumPlus(long[] a) {
long checkSum = 0;
for (long e : a) {
checkSum += e;
}
return (int) checkSum;
}
private static int checkSumPlus(short[] a) {
short checkSum = 0;
for (short e : a) {
checkSum += e;
}
return (int) checkSum;
}
private static int checkSumPlus(byte[] a) {
byte checkSum = 0;
for (byte e : a) {
checkSum += e;
}
return (int) checkSum;
}
private static int checkSumPlus(char[] a) {
char checkSum = 0;
for (char e : a) {
checkSum += e;
}
return (int) checkSum;
}
private static int checkSumPlus(float[] a) {
int checkSum = 0;
for (float e : a) {
checkSum += (int) e;
}
return checkSum;
}
private static int checkSumPlus(double[] a) {
int checkSum = 0;
for (double e : a) {
checkSum += (int) e;
}
return checkSum;
}
int checkSum = 0;
for (Integer e : a) {
}
return checkSum;
}
if (object instanceof int[]) {
sortByInsertionSort((int[]) object);
} else if (object instanceof long[]) {
sortByInsertionSort((long[]) object);
} else if (object instanceof short[]) {
sortByInsertionSort((short[]) object);
} else if (object instanceof byte[]) {
sortByInsertionSort((byte[]) object);
} else if (object instanceof char[]) {
sortByInsertionSort((char[]) object);
} else if (object instanceof float[]) {
sortByInsertionSort((float[]) object);
} else if (object instanceof double[]) {
sortByInsertionSort((double[]) object);
} else {
}
}
private static void sortByInsertionSort(int[] a) {
for (int j, i = 1; i < a.length; i++) {
int ai = a[i];
a[j + 1] = a[j];
}
a[j + 1] = ai;
}
}
private static void sortByInsertionSort(long[] a) {
for (int j, i = 1; i < a.length; i++) {
long ai = a[i];
a[j + 1] = a[j];
}
a[j + 1] = ai;
}
}
private static void sortByInsertionSort(short[] a) {
for (int j, i = 1; i < a.length; i++) {
short ai = a[i];
a[j + 1] = a[j];
}
a[j + 1] = ai;
}
}
private static void sortByInsertionSort(byte[] a) {
for (int j, i = 1; i < a.length; i++) {
byte ai = a[i];
a[j + 1] = a[j];
}
a[j + 1] = ai;
}
}
private static void sortByInsertionSort(char[] a) {
for (int j, i = 1; i < a.length; i++) {
char ai = a[i];
a[j + 1] = a[j];
}
a[j + 1] = ai;
}
}
private static void sortByInsertionSort(float[] a) {
for (int j, i = 1; i < a.length; i++) {
float ai = a[i];
a[j + 1] = a[j];
}
a[j + 1] = ai;
}
}
private static void sortByInsertionSort(double[] a) {
for (int j, i = 1; i < a.length; i++) {
double ai = a[i];
a[j + 1] = a[j];
}
a[j + 1] = ai;
}
}
for (int j, i = 1; i < a.length; i++) {
a[j + 1] = a[j];
}
a[j + 1] = ai;
}
}
if (object instanceof int[]) {
} else if (object instanceof long[]) {
} else if (object instanceof short[]) {
} else if (object instanceof byte[]) {
} else if (object instanceof char[]) {
} else if (object instanceof float[]) {
} else if (object instanceof double[]) {
} else {
}
}
if (object instanceof int[]) {
} else if (object instanceof long[]) {
} else if (object instanceof short[]) {
} else if (object instanceof byte[]) {
} else if (object instanceof char[]) {
} else if (object instanceof float[]) {
} else if (object instanceof double[]) {
} else {
}
}
if (object instanceof int[]) {
} else if (object instanceof long[]) {
} else if (object instanceof short[]) {
} else if (object instanceof byte[]) {
} else if (object instanceof char[]) {
} else if (object instanceof float[]) {
} else if (object instanceof double[]) {
} else {
}
}
for (int i = 0; i < fromIndex; i++) {
if (a[i].intValue() != 0xDEDA) {
failed("Range sort changes left element on position " + i +
": " + a[i] + ", must be " + 0xDEDA);
}
}
}
}
if (a[i].intValue() != 0xBABA) {
failed("Range sort changes right element on position " + i +
": " + a[i] + ", must be " + 0xBABA);
}
}
}
for (int i = 0; i < fromIndex; i++) {
if (a[i] != 0xDEDA) {
failed("Range sort changes left element on position " + i +
": " + a[i] + ", must be " + 0xDEDA);
}
}
if (a[i] > a[i + 1]) {
}
}
if (a[i] != 0xBABA) {
failed("Range sort changes right element on position " + i +
": " + a[i] + ", must be " + 0xBABA);
}
}
}
for (int i = 0; i < fromIndex; i++) {
if (a[i] != (byte) 0xDEDA) {
failed("Range sort changes left element on position " + i +
": " + a[i] + ", must be " + 0xDEDA);
}
}
if (a[i] > a[i + 1]) {
}
}
if (a[i] != (byte) 0xBABA) {
failed("Range sort changes right element on position " + i +
": " + a[i] + ", must be " + 0xBABA);
}
}
}
for (int i = 0; i < fromIndex; i++) {
if (a[i] != (long) 0xDEDA) {
failed("Range sort changes left element on position " + i +
": " + a[i] + ", must be " + 0xDEDA);
}
}
if (a[i] > a[i + 1]) {
}
}
if (a[i] != (long) 0xBABA) {
failed("Range sort changes right element on position " + i +
": " + a[i] + ", must be " + 0xBABA);
}
}
}
for (int i = 0; i < fromIndex; i++) {
if (a[i] != (char) 0xDEDA) {
failed("Range sort changes left element on position " + i +
": " + a[i] + ", must be " + 0xDEDA);
}
}
if (a[i] > a[i + 1]) {
}
}
if (a[i] != (char) 0xBABA) {
failed("Range sort changes right element on position " + i +
": " + a[i] + ", must be " + 0xBABA);
}
}
}
for (int i = 0; i < fromIndex; i++) {
if (a[i] != (short) 0xDEDA) {
failed("Range sort changes left element on position " + i +
": " + a[i] + ", must be " + 0xDEDA);
}
}
if (a[i] > a[i + 1]) {
}
}
if (a[i] != (short) 0xBABA) {
failed("Range sort changes right element on position " + i +
": " + a[i] + ", must be " + 0xBABA);
}
}
}
for (int i = 0; i < fromIndex; i++) {
if (a[i] != (float) 0xDEDA) {
failed("Range sort changes left element on position " + i +
": " + a[i] + ", must be " + 0xDEDA);
}
}
if (a[i] > a[i + 1]) {
}
}
if (a[i] != (float) 0xBABA) {
failed("Range sort changes right element on position " + i +
": " + a[i] + ", must be " + 0xBABA);
}
}
}
for (int i = 0; i < fromIndex; i++) {
if (a[i] != (double) 0xDEDA) {
failed("Range sort changes left element on position " + i +
": " + a[i] + ", must be " + 0xDEDA);
}
}
if (a[i] > a[i + 1]) {
}
}
if (a[i] != (double) 0xBABA) {
failed("Range sort changes right element on position " + i +
": " + a[i] + ", must be " + 0xBABA);
}
}
}
if (object instanceof int[]) {
checkRange((int[]) object, m);
} else if (object instanceof long[]) {
checkRange((long[]) object, m);
} else if (object instanceof short[]) {
checkRange((short[]) object, m);
} else if (object instanceof byte[]) {
checkRange((byte[]) object, m);
} else if (object instanceof char[]) {
checkRange((char[]) object, m);
} else if (object instanceof float[]) {
checkRange((float[]) object, m);
} else if (object instanceof double[]) {
checkRange((double[]) object, m);
} else {
}
}
try {
failed("Sort does not throw IllegalArgumentException " +
" as expected: fromIndex = " + (m + 1) +
" toIndex = " + m);
}
catch (IllegalArgumentException iae) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: fromIndex = " + (-m));
}
catch (ArrayIndexOutOfBoundsException aoe) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: toIndex = " + (a.length + m));
}
catch (ArrayIndexOutOfBoundsException aie) {
return;
}
}
}
}
private static void checkRange(int[] a, int m) {
try {
failed("Sort does not throw IllegalArgumentException " +
" as expected: fromIndex = " + (m + 1) +
" toIndex = " + m);
}
catch (IllegalArgumentException iae) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: fromIndex = " + (-m));
}
catch (ArrayIndexOutOfBoundsException aoe) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: toIndex = " + (a.length + m));
}
catch (ArrayIndexOutOfBoundsException aie) {
return;
}
}
}
}
private static void checkRange(long[] a, int m) {
try {
failed("Sort does not throw IllegalArgumentException " +
" as expected: fromIndex = " + (m + 1) +
" toIndex = " + m);
}
catch (IllegalArgumentException iae) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: fromIndex = " + (-m));
}
catch (ArrayIndexOutOfBoundsException aoe) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: toIndex = " + (a.length + m));
}
catch (ArrayIndexOutOfBoundsException aie) {
return;
}
}
}
}
private static void checkRange(byte[] a, int m) {
try {
failed("Sort does not throw IllegalArgumentException " +
" as expected: fromIndex = " + (m + 1) +
" toIndex = " + m);
}
catch (IllegalArgumentException iae) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: fromIndex = " + (-m));
}
catch (ArrayIndexOutOfBoundsException aoe) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: toIndex = " + (a.length + m));
}
catch (ArrayIndexOutOfBoundsException aie) {
return;
}
}
}
}
private static void checkRange(short[] a, int m) {
try {
failed("Sort does not throw IllegalArgumentException " +
" as expected: fromIndex = " + (m + 1) +
" toIndex = " + m);
}
catch (IllegalArgumentException iae) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: fromIndex = " + (-m));
}
catch (ArrayIndexOutOfBoundsException aoe) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: toIndex = " + (a.length + m));
}
catch (ArrayIndexOutOfBoundsException aie) {
return;
}
}
}
}
private static void checkRange(char[] a, int m) {
try {
failed("Sort does not throw IllegalArgumentException " +
" as expected: fromIndex = " + (m + 1) +
" toIndex = " + m);
}
catch (IllegalArgumentException iae) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: fromIndex = " + (-m));
}
catch (ArrayIndexOutOfBoundsException aoe) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: toIndex = " + (a.length + m));
}
catch (ArrayIndexOutOfBoundsException aie) {
return;
}
}
}
}
private static void checkRange(float[] a, int m) {
try {
failed("Sort does not throw IllegalArgumentException " +
" as expected: fromIndex = " + (m + 1) +
" toIndex = " + m);
}
catch (IllegalArgumentException iae) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: fromIndex = " + (-m));
}
catch (ArrayIndexOutOfBoundsException aoe) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: toIndex = " + (a.length + m));
}
catch (ArrayIndexOutOfBoundsException aie) {
return;
}
}
}
}
private static void checkRange(double[] a, int m) {
try {
failed("Sort does not throw IllegalArgumentException " +
" as expected: fromIndex = " + (m + 1) +
" toIndex = " + m);
}
catch (IllegalArgumentException iae) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: fromIndex = " + (-m));
}
catch (ArrayIndexOutOfBoundsException aoe) {
try {
failed("Sort does not throw ArrayIndexOutOfBoundsException " +
" as expected: toIndex = " + (a.length + m));
}
catch (ArrayIndexOutOfBoundsException aie) {
return;
}
}
}
}
for (int i = 0; i < a.length; i++) {
}
}
private static void outArray(int[] a) {
for (int i = 0; i < a.length; i++) {
}
}
private static void outArray(float[] a) {
for (int i = 0; i < a.length; i++) {
}
}
private static void outArray(double[] a) {
for (int i = 0; i < a.length; i++) {
}
}
super(seed);
}
long getSeed() {
return mySeed;
}
private long mySeed;
}
}