Here you can find the source of charToBytes(char c)
public static byte[] charToBytes(char c)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] charToBytes(char c) { byte[] b = new byte[8]; b[0] = (byte) (c >>> 8); b[1] = (byte) c; return b; }//from w w w . jav a 2 s.co m }