Here you can find the source of charToBytes(byte[] arr, int offset, char c)
public static int charToBytes(byte[] arr, int offset, char c)
//package com.java2s; //License from project: Open Source License public class Main { public static int charToBytes(byte[] arr, int offset, char c) { arr[offset + 0] = (byte) ((int) (c & 0xFF00) >> 8); arr[offset + 1] = (byte) (c & 0xFF); return 2; }/* ww w . j ava 2s.c om*/ }