### Question:
Numbers { public static byte safeCastLongToByte( long value ) { if ( (byte) value != value ) { throw new ArithmeticException( getOverflowMessage( value, Byte.TYPE ) ); } return (byte) value; }  static boolean isPowerOfTwo( long value ); static int log2floor( long value ); static short safeCastIntToUnsignedShort( int value ); static byte safeCastIntToUnsignedByte( int value ); static int safeCastLongToInt( long value ); static short safeCastLongToShort( long value ); static short safeCastIntToShort( int value ); static byte safeCastLongToByte( long value ); static int unsignedShortToInt( short value ); static int unsignedByteToInt( byte value );  }### Answer:
@Test void failSafeCastLongToByte() { expectedException.expect( ArithmeticException.class ); expectedException.expectMessage( "Value 128 is too big to be represented as byte" ); safeCastLongToByte( Byte.MAX_VALUE + 1 ); }
@Test void castLongToByte() { assertEquals(1, safeCastLongToByte( 1L )); assertEquals(10, safeCastLongToByte( 10L )); assertEquals(-1, safeCastLongToByte( -1L )); assertEquals(Byte.MAX_VALUE, safeCastLongToByte( Byte.MAX_VALUE )); assertEquals(Byte.MIN_VALUE, safeCastLongToByte( Byte.MIN_VALUE )); }