public static String toHexString(byte[] value){
  if (value == null) {
    return null;
  }
  StringBuffer buffer=new StringBuffer(2 * value.length);
  int single;
  for (int i=0; i < value.length; i++) {
    single=value[i] & 0xFF;
    if (single < 0x10) {
      buffer.append('0');
    }
    buffer.append(Integer.toString(single,16));
  }
  return buffer.toString();
}

public static String toHexString ( byte [ ] value ) { if ( value == null ) { return null ; } StringBuffer buffer = new StringBuffer ( 2 * value . length ) ; int single ; for ( int i = 0 ; i < value . length ; i ++ ) { single = value [ i ] & 0xFF ; if ( single < 0x10 ) { buffer . append ( '0' ) ; } buffer . append ( Integer . toString ( single , 16 ) ) ; } return buffer . toString ( ) ; }
converts a byte array to a hexadecimal string . each byte is presented by its two digit hex - code ; 0x0a - > " 0a " , 0x00 - > " 00 " . no leading " 0x " is included in the result .
