public static String toString(final byte[] bytes){
  StringBuilder hexed=new StringBuilder();
  for (int i=0; i < bytes.length; i++) {
    hexed.append(toString(bytes[i]));
    hexed.append(' ');
  }
  return hexed.substring(0,hexed.length() - 1);
}

public static String toString ( final byte [ ] bytes ) { StringBuilder hexed = new StringBuilder ( ) ; for ( int i = 0 ; i < bytes . length ; i ++ ) { hexed . append ( toString ( bytes [ i ] ) ) ; hexed . append ( ' ' ) ; } return hexed . substring ( 0 , hexed . length ( ) - 1 ) ; }
turns an array of bytes into a hexadecimal string .
