private static String generateString(byte[] bytes) {

    StringBuffer sb = new StringBuffer();

    for (byte b : bytes) {

      int v = b & 0xFF;

      sb.append((char) HEX.charAt(v >> 4));
      sb.append((char) HEX.charAt(v & 0x0f));
    }

    return sb.toString();
  }
private static String generateString ( byte [ ] bytes ) { StringBuffer sb = new StringBuffer ( ) ; for ( byte b : bytes ) { int v = b & 0xFF ; sb . append ( ( char ) HEX . charAt ( v > > 4 ) ) ; sb . append ( ( char ) HEX . charAt ( v & 0x0f ) ) ; } return sb . toString ( ) ; }
Converts the array of bytes into a HEX string.

@param bytes
byte array
@return HEX string