Java tutorial
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static void putString(ByteBuffer buf, String str) { int len = str.length(); for (int i = 0; i < len; i++) { buf.putChar(str.charAt(i)); } } }