Here you can find the source of charTo2Byte(char x)
public static byte[] charTo2Byte(char x)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] charTo2Byte(char x) { return new byte[] { (byte) (x >> 8), (byte) x }; }//ww w . j a v a 2 s .co m }