public static byte [ ] toArray ( Collection < ? extends Number > bytes ) { byte [ ] array = new byte [ bytes . size ( ) ] ; Iterator < ? extends Number > iter = bytes . iterator ( ) ; for ( int i = 0 ; i < bytes . size ( ) ; i ++ ) { array [ i ] = iter . next ( ) . byteValue ( ) ; } return array ; }
Converts a Collection of Number to a byte array .