static String toHex ( byte [ ] data ) { StringBuffer sb = new StringBuffer ( data . length * 2 ) ; for ( int i = 0 ; i < data . length ; i ++ ) { sb . append ( hexc [ ( data [ i ] >> 4 ) & 0x0f ] ) ; sb . append ( hexc [ data [ i ] & 0x0f ] ) ; } return sb . toString ( ) ; }
convert a byte array to a hex string for debugging purposes