static protected byte [ ] getBytes ( int bitString ) { int bytes = 4 ; for ( int i = 3 ; i >= 1 ; i -- ) { if ( ( bitString & ( 0xFF << ( i * 8 ) ) ) != 0 ) { break ; } bytes -- ; } byte [ ] result = new byte [ bytes ] ; for ( int i = 0 ; i < bytes ; i ++ ) { result [ i ] = ( byte ) ( ( bitString >> ( i * 8 ) ) & 0xFF ) ; } return result ; }
return the correct number of bytes for a bit string defined in a 32 bit constant