Here you can find the source of toBytes(byte[] buffer, int pos, String string)
public static int toBytes(byte[] buffer, int pos, String string)
//package com.java2s; //License from project: Apache License public class Main { public static int toBytes(byte[] buffer, int pos, String string) { byte[] strBytes = string.getBytes(); System.arraycopy(strBytes, 0, buffer, pos, strBytes.length); return pos + strBytes.length; }//ww w .ja v a 2s . c o m }