public static String byteToHex ( byte [ ] data ) { if ( data == null ) { return null ; } final StringBuilder builder = new StringBuilder ( ) ; for ( final byte b : data ) { builder . append ( String . format ( "%02X" , b ) ) ; } return builder . toString ( ) ; }
Convert byte data to hex code string .