private static String hexEncode(byte data[]){
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < data.length; ++i) {
    sb.append(String.format("%02x",data[i]));
  }
  return sb.toString();
}

private static String hexEncode ( byte data [ ] ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < data . length ; ++ i ) { sb . append ( String . format ( "%02x" , data [ i ] ) ) ; } return sb . toString ( ) ; }
hex - encode a byte array
