question: public static byte [ ] toByteArray ( String str ) { int len = str . length ( ) ; StringTokenizer st = new StringTokenizer ( str , ":" ) ; String [ ] newStrArray = new String [ st . countTokens ( ) ] ; int j = 0 ; while ( st . hasMoreTokens ( ) ) { newStrArray [ j ] = st . nextToken ( ) ; j ++ ; } byte [ ] ret = new byte [ newStrArray . length ] ; int tmp ; for ( int i = 0 ; i < newStrArray . length ; i ++ ) { tmp = Integer . parseInt ( newStrArray [ i ] , 16 ) ; ret [ i ] = ( byte ) ( tmp - 128 ) ; } return ret ; }
target:  Converts a given hex String separated by colons to a byte array.