private static final String toHexString(final byte[] bs){
  String hex="0123456789ABCDEF";
  StringBuilder res=new StringBuilder();
  for (  byte b : bs) {
    res.append(hex.charAt(((b >>> 4) & 0xF)));
    res.append(hex.charAt((b & 0xF)));
  }
  return res.toString();
}

private static final String toHexString ( final byte [ ] bs ) { String hex = "0123456789ABCDEF" ; StringBuilder res = new StringBuilder ( ) ; for ( byte b : bs ) { res . append ( hex . charAt ( ( ( b > > > 4 ) & 0xF ) ) ) ; res . append ( hex . charAt ( ( b & 0xF ) ) ) ; } return res . toString ( ) ; }
convert and array of bytes to a hex string .
