public static String hexCodeString(byte[] code){
  if (code == null) {
    return "";
  }
 else {
    StringBuilder sb=new StringBuilder(code.length * 2);
    for (    int b : code) {
      String hex=Integer.toHexString(b & 0xff);
      if (hex.length() == 1) {
        sb.append('0');
      }
      sb.append(hex);
    }
    return sb.toString();
  }
}

public static String hexCodeString ( byte [ ] code ) { if ( code == null ) { return "" ; } else { StringBuilder sb = new StringBuilder ( code . length * 2 ) ; for ( int b : code ) { String hex = Integer . toHexString ( b & 0xff ) ; if ( hex . length ( ) == 1 ) { sb . append ( '0' ) ; } sb . append ( hex ) ; } return sb . toString ( ) ; } }
formats a byte array as a string of hex digits .
