Here you can find the source of stripToCommonChars(char[] ac, BitSet commonChars)
private static char[] stripToCommonChars(char[] ac, BitSet commonChars)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.BitSet; public class Main { private static final int ASCII_LOWER = 65; private static char[] stripToCommonChars(char[] ac, BitSet commonChars) { char[] ap = new char[ac.length]; int api = 0; for (int i = 0; i < ac.length; i++) { if (commonChars.get(ac[i] - ASCII_LOWER)) { ap[api++] = ac[i];//from w w w.j a v a 2s .c o m } } return Arrays.copyOf(ap, api); } }