static String toHexString ( byte [ ] data ) { char [ ] chArray = new char [ data . length * 2 ] ; int pos = 0 ; for ( byte b : data ) { chArray [ pos ++ ] = HEX_CHARS [ ( b >> 4 ) & 0x0f ] ; chArray [ pos ++ ] = HEX_CHARS [ b & 0x0f ] ; } return new String ( chArray ) ; }
Convert byte array to a hexa - string .