Java BitSet stripToCommonChars(char[] ac, BitSet commonChars)

Here you can find the source of stripToCommonChars(char[] ac, BitSet commonChars)

Description

strip To Common Chars

License

Apache License

Declaration

private static char[] stripToCommonChars(char[] ac, BitSet commonChars) 

Method Source Code

//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);
    }
}

Related

  1. shiftLeft(BitSet src, int offset)
  2. shiftRight(BitSet bitset, int n)
  3. storeCharSet(BitSet stored, String... validCharStrings)
  4. strArrToBitSet(String stringArray)
  5. stringToBitSet(String sbits)
  6. toArray(BitSet bitset, int size)
  7. toBitSet(byte[] array)
  8. toBitSet(byte[] bytes)
  9. toBitSet(final byte[] bytes)