Here you can find the source of toAsciiByteArray(final char[] carr)
public static byte[] toAsciiByteArray(final char[] carr)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] toAsciiByteArray(final char[] carr) { final byte[] barr = new byte[carr.length]; for (int i = 0; i < carr.length; ++i) { barr[i] = (byte) ((carr[i] <= '\u00ff') ? carr[i] : '?'); }/*from ww w . j a v a 2 s.c o m*/ return barr; } public static byte[] toAsciiByteArray(final CharSequence charSequence) { final byte[] barr = new byte[charSequence.length()]; for (int i = 0; i < barr.length; ++i) { final char c = charSequence.charAt(i); barr[i] = (byte) ((c <= '\u00ff') ? c : '?'); } return barr; } }