Here you can find the source of convertStringToHex(String str)
public static String convertStringToHex(String str)
//package com.java2s; //License from project: Open Source License public class Main { public static String convertStringToHex(String str) { char[] chars = str.toCharArray(); StringBuffer hex = new StringBuffer(); for (int i = 0; i < chars.length; i++) { hex.append(Integer.toHexString((int) chars[i])); }//w w w .j av a 2s . c o m return hex.toString(); } }