Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static void putChar(byte[] bb, char ch, int index) { int temp = ch; for (int i = 0; i < 2; i++) { bb[(index + i)] = Integer.valueOf(temp & 0xFF).byteValue(); temp >>= 8; } } }