private static String hexDigest(byte[] bArr){
  StringBuilder sb=new StringBuilder();
  for (  byte aBArr : bArr) {
    int unsigned=aBArr & 0xff;
    if (unsigned < 0x10)     sb.append("0");
    sb.append(Integer.toHexString((unsigned)));
  }
  return sb.toString();
}

private static String hexDigest ( byte [ ] bArr ) { StringBuilder sb = new StringBuilder ( ) ; for ( byte aBArr : bArr ) { int unsigned = aBArr & 0xff ; if ( unsigned < 0x10 ) sb . append ( "0" ) ; sb . append ( Integer . toHexString ( ( unsigned ) ) ) ; } return sb . toString ( ) ; }
converts a byte array into a hexidecimal string .
