### Question:
IntArrayComparator implements Comparator<int[]> { private IntArrayComparator() { } private  IntArrayComparator(); int compare( int[] intArray1, int[] intArray2 ); static final IntArrayComparator INSTANCE; }### Answer:
@Test public void testIntArrayComparator() { IntArrayComparator comparator = IntArrayComparator.INSTANCE; assertEquals( 0, comparator.compare( null, null ) ); assertEquals( 0, comparator.compare( new int[] {}, new int[] {} ) ); assertEquals( 0, comparator.compare( new int[] { 1, 2 }, new int[] { 1, 2 } ) ); assertEquals( 1, comparator.compare( new int[] {}, null ) ); assertEquals( 1, comparator.compare( new int[] { 1 }, null ) ); assertEquals( 1, comparator.compare( new int[] { 1, 2 }, new int[] { 1, 1 } ) ); assertEquals( 1, comparator.compare( new int[] { 1, 2, 1 }, new int[] { 1, 2 } ) ); assertEquals( 1, comparator.compare( new int[] { 1, 2 }, new int[] { 1, 1, 2 } ) ); assertEquals( -1, comparator.compare( null, new int[] {} ) ); assertEquals( -1, comparator.compare( null, new int[] { 1, 2 } ) ); assertEquals( -1, comparator.compare( null, new int[] { -1, 2 } ) ); assertEquals( -1, comparator.compare( new int[] {}, new int[] { 1, 2 } ) ); assertEquals( -1, comparator.compare( new int[] {}, new int[] { -1, 2 } ) ); assertEquals( -1, comparator.compare( new int[] { -1, 1 }, new int[] { 1, 1, 2 } ) ); int[] array = new int[3]; array[0] = 1; array[1] = 2; assertEquals( -1, comparator.compare( new int[] { 1, 2 }, array ) ); }