public static String bytesToHexString(final byte[] bytes,Character delimiter){
  StringBuffer hex=new StringBuffer(bytes.length * (delimiter == null ? 2 : 3));
  int nibble1, nibble2;
  for (int i=0; i < bytes.length; i++) {
    nibble1=(bytes[i] >>> 4) & 0xf;
    nibble2=bytes[i] & 0xf;
    if (i > 0 && delimiter != null)     hex.append(delimiter.charValue());
    hex.append(hexChars[nibble1]);
    hex.append(hexChars[nibble2]);
  }
  return hex.toString();
}

public static String bytesToHexString ( final byte [ ] bytes , Character delimiter ) { StringBuffer hex = new StringBuffer ( bytes . length * ( delimiter == null ? 2 : 3 ) ) ; int nibble1 , nibble2 ; for ( int i = 0 ; i < bytes . length ; i ++ ) { nibble1 = ( bytes [ i ] > > > 4 ) & 0xf ; nibble2 = bytes [ i ] & 0xf ; if ( i > 0 && delimiter != null ) hex . append ( delimiter . charValue ( ) ) ; hex . append ( hexChars [ nibble1 ] ) ; hex . append ( hexChars [ nibble2 ] ) ; } return hex . toString ( ) ; }
convert a byte array to a hex - encoding string with the specified delimiter : " a3 & lt ; delimiter & gt ; 3b & lt ; delimiter & gt ; ff . . . "
