### Question:
NumberValues { public static int hash( long number ) { int asInt = (int) number; if ( asInt == number ) { return asInt; } return Long.hashCode( number ); } private  NumberValues(); static int hash( long number ); static int hash( double number ); static int hash( byte[] values ); static int hash( short[] values ); static int hash( char[] values ); static int hash( int[] values ); static int hash( long[] values ); static int hash( float[] values ); static int hash( double[] values ); static int hash( boolean[] value ); static boolean numbersEqual( double fpn, long in ); static int compareDoubleAgainstLong( double lhs, long rhs ); static int compareLongAgainstDouble( long lhs, double rhs ); static boolean numbersEqual( IntegralArray lhs, IntegralArray rhs ); static boolean numbersEqual( FloatingPointArray lhs, FloatingPointArray rhs ); static boolean numbersEqual( FloatingPointArray fps, IntegralArray ins ); static int compareIntegerArrays( IntegralArray a, IntegralArray b ); static int compareIntegerVsFloatArrays( IntegralArray a, FloatingPointArray b ); static int compareFloatArrays( FloatingPointArray a, FloatingPointArray b ); static int compareBooleanArrays( BooleanArray a, BooleanArray b );  }### Answer:
@Test void shouldHashNaN() { assertThat( hash( Double.NaN ), equalTo( hash( Float.NaN ) ) ); }
@Test void shouldHashInfinite() { assertThat( hash( Double.NEGATIVE_INFINITY ), equalTo( hash( Float.NEGATIVE_INFINITY ) ) ); assertThat( hash( Double.POSITIVE_INFINITY ), equalTo( hash( Float.POSITIVE_INFINITY ) ) ); }
@Test void shouldHashIntegralDoubleAsLong() { assertThat( hash( 1337d ), equalTo( hash( 1337L ) ) ); }
@Test void shouldGiveSameResultEvenWhenArraysContainDifferentTypes() { int[] ints = new int[32]; long[] longs = new long[32]; Random r = ThreadLocalRandom.current(); for ( int i = 0; i < 32; i++ ) { int nextInt = r.nextInt(); ints[i] = nextInt; longs[i] = nextInt; } assertThat( hash( ints ), equalTo( hash( longs ) ) ); }
@Test void shouldGiveSameHashForLongsAndInts() { Random r = ThreadLocalRandom.current(); for ( int i = 0; i < 1_000_000; i++ ) { int anInt = r.nextInt(); assertThat( anInt, equalTo( hash( (long) anInt ) ) ); } }
@Test void shouldGiveSameResultEvenWhenArraysContainDifferentTypes2() { byte[] bytes = new byte[32]; short[] shorts = new short[32]; Random r = ThreadLocalRandom.current(); for ( int i = 0; i < 32; i++ ) { byte nextByte = ((Number) (r.nextInt())).byteValue(); bytes[i] = nextByte; shorts[i] = nextByte; } assertThat( hash( bytes ), equalTo( hash( shorts ) ) ); }