Here you can find the source of StringtoByte(String data)
public static byte[] StringtoByte(String data)
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { public final static String DEFAULT_CHARSET = "UTF-8"; public static byte[] StringtoByte(String data) { try {// w w w . ja va 2 s . c o m return data.getBytes(DEFAULT_CHARSET); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }