static String toHexString ( final byte [ ] b ) { StringBuffer sb = new StringBuffer ( "{" ) ; for ( int i = 0 ; i < b . length ; i ++ ) { sb . append ( toHexString ( b [ i ] ) ) ; if ( i < b . length - 1 ) { sb . append ( "," ) ; } } sb . append ( "}" ) ; return sb . toString ( ) ; }
Converts a byte array into its hexadecimal representation padding each with a leading zero to get an even number of characters .