Here you can find the source of stringToBytes(String string)
public static byte[] stringToBytes(String string)
//package com.java2s; //License from project: Apache License import java.util.StringTokenizer; public class Main { public static byte[] stringToBytes(String string) { StringTokenizer tokenizer = new StringTokenizer(string, ","); byte[] bytes = new byte[tokenizer.countTokens()]; for (int k = 0; k < bytes.length; k++) bytes[k] = (byte) Integer.parseInt(tokenizer.nextToken()); return bytes; }/*from ww w . j ava 2 s .c o m*/ }