public final static byte [ ] toByteArray ( String uid ) { byte [ ] result = new byte [ 16 ] ; char [ ] chars = uid . toCharArray ( ) ; int r = 0 ; for ( int i = 0 ; i < chars . length ; ++ i ) { if ( chars [ i ] == ' ' ) { continue ; } int h1 = Character . digit ( chars [ i ] , 16 ) ; ++ i ; int h2 = Character . digit ( chars [ i ] , 16 ) ; result [ ( r ++ ) ] = ( byte ) ( ( h1 << 4 | h2 ) & 0xFF ) ; } return result ; }
Returns a byte array for the given uuid or guid .