question: private static byte [ ] codesToBytes ( String codes , boolean required ) { if ( codes . length ( ) == 0 ) { if ( required ) { throw new IllegalStateException ( "empty code bytes" ) ; } return null ; } if ( ( codes . length ( ) % 2 ) != 0 ) { codes = "0" + codes ; } byte [ ] bytes = new byte [ codes . length ( ) / 2 ] ; for ( int i = 0 ; i < bytes . length ; ++ i ) { int charIdx = i * 2 ; bytes [ i ] = ( byte ) ( Integer . parseInt ( codes . substring ( charIdx , charIdx + 2 ) , 16 ) ) ; } return bytes ; }
target:  Converts a string of hex encoded bytes to a byte[], optionally throwing an exception if no codes are given.