Here you can find the source of toAsciiArray(char[] carr)
public static byte[] toAsciiArray(char[] carr)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w . j a va 2 s . c om * Converts char array into ASCII array. * @see #toAscii(char) */ public static byte[] toAsciiArray(char[] carr) { if (carr == null) return null; byte[] barr = new byte[carr.length]; for (int i = 0; i < carr.length; i++) barr[i] = (byte) toAscii(carr[i]); return barr; } /** * Converts char sequence into ASCII array. */ public static byte[] toAsciiArray(CharSequence charSequence) { if (charSequence == null) return null; byte[] barr = new byte[charSequence.length()]; for (int i = 0; i < barr.length; i++) barr[i] = (byte) toAscii(charSequence.charAt(i)); return barr; } /** * Returns ASCII symbol of a char. In case of overload, 0x3F is returned. */ public static int toAscii(char c) { if (c <= 0xFF) return c; else return 0x3F; } }