Here you can find the source of charToByte(char[] tab)
public static byte[] charToByte(char[] tab)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] charToByte(char[] tab) { byte[] result = new byte[tab.length]; for (int i = 0; i < tab.length; i++) { result[i] = (byte) tab[i]; }//from www . j ava 2 s. c om return result; } public static byte charToByte(char tab) { byte result = (byte) tab; return result; } }