Java tutorial
//package com.java2s; public class Main { public static String getCnASCII(String str) { StringBuffer sb = new StringBuffer(); byte[] strByte = str.getBytes(); for (int i = 0; i < strByte.length; i++) { sb.append(Integer.toHexString(strByte[i] & 0xff)); } return sb.toString(); } }