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