public static String toHEXString(String input){
  String hexTab="0123456789ABCDEF";
  StringBuilder output=new StringBuilder();
  int x;
  for (int i=0; i < input.length(); i++) {
    x=charCodeAt(input,i);
    output.append(hexTab.charAt((x >>> 4) & 0x0F));
    output.append(hexTab.charAt(x & 0x0F));
  }
  return output.toString();
}

public static String toHEXString ( String input ) { String hexTab = "0123456789ABCDEF" ; StringBuilder output = new StringBuilder ( ) ; int x ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { x = charCodeAt ( input , i ) ; output . append ( hexTab . charAt ( ( x > > > 4 ) & 0x0F ) ) ; output . append ( hexTab . charAt ( x & 0x0F ) ) ; } return output . toString ( ) ; }
convert a raw utf - 8 string to a hex string .
