字符串转BCD码
@param asc ASCII字符串
@return BCD
552276
public static byte[] strToBcd(String asc) {
		int len = asc.length();
		int mod = len % 2;
		if (mod != 0) {
			asc = "0" + asc;
			len = asc.length();
		}
		byte abt[] = new byte[len];
		if (len >= 2) {
			len >>= 1;
		}
		byte bbt[] = new byte[len];
		abt = asc.getBytes();
		int j;
		int k;
		for (int p = 0; p < asc.length() / 2; p++) {
			if ((abt[2 * p] >= '0') && (abt[2 * p] <= '9')) {
				j = abt[2 * p] - '0';
			} else if ((abt[2 * p] >= 'a') && (abt[2 * p] <= 'z')) {
				j = abt[2 * p] - 'a' + 0x0a;
			} else {
				j = abt[2 * p] - 'A' + 0x0a;
			}
			if ((abt[2 * p + 1] >= '0') && (abt[2 * p + 1] <= '9')) {
				k = abt[2 * p + 1] - '0';
			} else if ((abt[2 * p + 1] >= 'a') && (abt[2 * p + 1] <= 'z')) {
				k = abt[2 * p + 1] - 'a' + 0x0a;
			} else {
				k = abt[2 * p + 1] - 'A' + 0x0a;
			}
			int a = (j << 4) + k;
			byte b = (byte) a;
			bbt[p] = b;
		}
		return bbt;
	}
208466
public static DZcsd cs_scc(DZcs A)
	{
		int n, i, k, b, nb = 0, top, xi[], pstack[], p[], r[], Ap[], ATp[], rcopy[], Blk[] ;
		DZcs AT ;
		DZcsd D ;
		if (!CS_CSC (A)) return (null) ; 		/* check inputs */
		n = A.n ; Ap = A.p ;
		D = cs_dalloc (n, 0) ;				/* allocate result */
		AT = cs_transpose (A, false) ;			/* AT = A' */
		xi = new int [2*n+1] ;				/* get workspace */
		if (D == null || AT == null || xi == null)
			return (cs_ddone (D, AT, xi, false)) ;
		Blk = xi ; rcopy = xi ;
		int rcopy_offset = n ;
		pstack = xi ;
		int pstack_offset = n ;
		p = D.p ; r = D.r ; ATp = AT.p ;
		top = n ;
		for (i = 0 ; i < n ; i++)			/* first dfs(A) to find finish times (xi) */
		{
			if (!CS_MARKED (Ap, i))
			top = cs_dfs (i, A, top, xi, 0, pstack, pstack_offset, null, 0) ;
		}
		for (i = 0 ; i < n ; i++) CS_MARK (Ap, i) ;	/* restore A; unmark all nodes*/
		top = n ; nb = n ;
		for (k = 0 ; k < n ; k++)			/* dfs(A') to find strongly connnected comp */
		{
			i = xi [k] ;				/* get i in reverse order of finish times */
			if (CS_MARKED (ATp, i)) continue ;	/* skip node i if already ordered */
			r [nb--] = top ;			/* node i is the start of a component in p */
			top = cs_dfs (i, AT, top, p, 0, pstack, pstack_offset, null, 0) ;
		}
		r [nb] = 0 ;					/* first block starts at zero; shift r up */
		for (k = nb ; k <= n ; k++) r [k-nb] = r [k] ;
		D.nb = nb = n - nb ;				/* nb = # of strongly connected components */
		for (b = 0 ; b < nb ; b++)			/* sort each block in natural order */
		{
			for (k = r [b] ; k < r [b+1] ; k++) Blk [p [k]] = b ;
		}
		for (b = 0 ; b <= nb ; b++) rcopy [rcopy_offset + b] = r [b] ;
		for (i = 0 ; i < n ; i++) p [rcopy [rcopy_offset + Blk [i]]++] = i ;
		return (D) ;
	}
113683
static String typeDef(String typeDesc) {

    int pos = typeDesc.lastIndexOf(" :: ");
    if (pos > -1) {
      // (@javax.validation.constraints.Size(min=1, max=10) :: java.lang.String)
      typeDesc = typeDesc.substring(pos + 4, typeDesc.length() - 1);
    }
    return typeDesc;
  }
959762
private static long asciidump(InputStream is, PrintWriter pw) throws Exception
   {
      byte[] buffer = new byte[BUFFER_SIZE];
      long byteCount = 0;

      char c;
      int loop;
      int count;
      StringBuilder sb = new StringBuilder();

      while (true)
      {
         count = is.read(buffer);
         if (count == -1)
         {
            break;
         }

         byteCount += count;

         sb.setLength(0);
         for (loop = 0; loop < count; loop++)
         {
            c = (char) buffer[loop];
            if (c > 200 || c < 27)
            {
               c = ' ';
            }

            sb.append(c);
         }

         pw.print(sb.toString());
      }

      return (byteCount);
   }
427411
public static String getUS7ASCIIEquiv(String convertString) {
    if (convertString == null)
      return null;

    StringBuilder convertedString = new StringBuilder();
    String upperConvertString = convertString.toUpperCase();

    Collator collator = Collator.getInstance(Locale.US);
    collator.setStrength(Collator.PRIMARY);

    String chars = "abcdefghijklmnopqrstuvwxyz";
    for (int i = 0; i < convertString.length(); i++) {
      char currentChar = convertString.charAt(i);
      boolean isUppercase = currentChar == upperConvertString.charAt(i);
      char mappedChar = ' ';
      if (currentChar < 128) {
        // Within low-ascii, leave it alone.
        mappedChar = currentChar;
      } else if (currentChar < 256) {
        for (int j = 0; j < chars.length(); j++) {
          if (collator.compare(currentChar + "", chars.charAt(j) + "") == 0) {
            if (isUppercase)
              mappedChar = Character.toUpperCase(chars.charAt(j));
            else
              mappedChar = chars.charAt(j);
            break;
          }
        }
      } else {
        // Out of our mapping range. It just becomes a space
      }
      convertedString.append(mappedChar);
    }
    return convertedString.toString();
  }
445873
@Override
    public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) {
        return asciiCaseFoldCodesByString(flag, bytes, p, end);
    }
1372999
protected static String getAsciiStringFrom6BitStr(String str) {

		StringBuilder txt = new StringBuilder();
		for (int i = 0; i < str.length(); i = i + 6) {
			byte _byte = (byte) Integer.parseInt(str.substring(i, i + 6), 2);
			_byte = convert6BitCharToStandardAscii(_byte);
			char convChar = (char) _byte;

			if (convChar == '@') {
				break;
			}
			txt.append((char) _byte);
		}

		return txt.toString().trim();
	}
903190
@Benchmark
  @BenchmarkMode(Mode.SampleTime)
  @OutputTimeUnit(TimeUnit.NANOSECONDS)
  public Status codeDecode() {
    return Status.CODE_KEY.parseBytes("15".getBytes(Charset.forName("US-ASCII")));
  }
632116
public static AsciiString of(AsciiString name) {
        final AsciiString lowerCased = name.toLowerCase();
        final AsciiString cached = map.get(lowerCased);
        return cached != null ? cached : lowerCased;
    }
1104207
def to_s
      #check whether any `high` bits are set
      @bmp[0] = false
      65.upto(128) {|i|
        if self[i]
          # if so, set continuation bit
          @bmp[0] = true
          break
        end
      }
      str = "".force_encoding("ASCII-8BIT")
      1.upto(self[1] ? 128 : 64) {|i|
        str << (self[i] ? "1" : "0")
      }
      str
    end
767721
private static String toAsciiString(byte[] bytes) {
        for(int i = 0; i < bytes.length; i++) {
            if(bytes[i] < 0) return null;
        }
        char[] chars = new char[bytes.length];
        for(int i = 0; i < bytes.length; i++) {
            chars[i] = (char)bytes[i];
        }
        return new String(chars);
    }
292050
private static BigInteger[] decodeECDSASignature(byte[] signature) throws Exception {

        try (ByteArrayInputStream inStream = new ByteArrayInputStream(signature)) {
            ASN1InputStream asnInputStream = new ASN1InputStream(inStream);
            ASN1Primitive asn1 = asnInputStream.readObject();

            BigInteger[] sigs = new BigInteger[2];
            int count = 0;
            if (asn1 instanceof ASN1Sequence) {
                ASN1Sequence asn1Sequence = (ASN1Sequence) asn1;
                ASN1Encodable[] asn1Encodables = asn1Sequence.toArray();
                for (ASN1Encodable asn1Encodable : asn1Encodables) {
                    ASN1Primitive asn1Primitive = asn1Encodable.toASN1Primitive();
                    if (asn1Primitive instanceof ASN1Integer) {
                        ASN1Integer asn1Integer = (ASN1Integer) asn1Primitive;
                        BigInteger integer = asn1Integer.getValue();
                        if (count < 2) {
                            sigs[count] = integer;
                        }
                        count++;
                    }
                }
            }
            if (count != 2) {
                throw new CryptoException(format("Invalid ECDSA signature. Expected count of 2 but got: %d. Signature is: %s", count,
                        DatatypeConverter.printHexBinary(signature)));
            }
            return sigs;
        }

    }
1208330
public static byte[] decode(String s) {
        int delta = s.endsWith( "==" ) ? 2 : s.endsWith( "=" ) ? 1 : 0;
        byte[] buffer = new byte[s.length() * 3 / 4 - delta];
        int mask = 0xFF;
        int index = 0;
        for (int i = 0; i < s.length(); i += 4) {
            int c0 = toInt[s.charAt( i )];
            int c1 = toInt[s.charAt( i + 1)];
            buffer[index++] = (byte)(((c0 << 2) | (c1 >> 4)) & mask);
            if (index >= buffer.length) {
                return buffer;
            }
            int c2 = toInt[s.charAt( i + 2)];
            buffer[index++] = (byte)(((c1 << 4) | (c2 >> 2)) & mask);
            if (index >= buffer.length) {
                return buffer;
            }
            int c3 = toInt[s.charAt( i + 3 )];
            buffer[index++] = (byte)(((c2 << 6) | c3) & mask);
        }
        return buffer;
    }
147649
public static function charAsciiAlphaUpperArray()
    {
        static $result = array();

        if (!$result) {
            for ($i = 65; $i < 91; ++$i) {
                $result[] = \chr($i);
            }
        }

        return $result;
    }
987059
public static AsciiString readAsciiString(DataInput in) throws IOException {
        short len=in.readShort();
        if(len < 0)
            return null;
        AsciiString retval=new AsciiString(len);
        in.readFully(retval.chars());
        return retval;
    }
466275
static BinaryToASCIIConverter getBinaryToASCIIConverter(double d, boolean isCompatibleFormat) {
        long dBits = Double.doubleToRawLongBits(d);
        boolean isNegative = (dBits&DoubleConsts.SIGN_BIT_MASK) != 0; // discover sign
        long fractBits = dBits & DoubleConsts.SIGNIF_BIT_MASK;
        int  binExp = (int)( (dBits&DoubleConsts.EXP_BIT_MASK) >> EXP_SHIFT );
        // Discover obvious special cases of NaN and Infinity.
        if ( binExp == (int)(DoubleConsts.EXP_BIT_MASK>>EXP_SHIFT) ) {
            if ( fractBits == 0L ){
                return isNegative ? B2AC_NEGATIVE_INFINITY : B2AC_POSITIVE_INFINITY;
            } else {
                return B2AC_NOT_A_NUMBER;
            }
        }
        // Finish unpacking
        // Normalize denormalized numbers.
        // Insert assumed high-order bit for normalized numbers.
        // Subtract exponent bias.
        int  nSignificantBits;
        if ( binExp == 0 ){
            if ( fractBits == 0L ){
                // not a denorm, just a 0!
                return isNegative ? B2AC_NEGATIVE_ZERO : B2AC_POSITIVE_ZERO;
            }
            int leadingZeros = Long.numberOfLeadingZeros(fractBits);
            int shift = leadingZeros-(63-EXP_SHIFT);
            fractBits <<= shift;
            binExp = 1 - shift;
            nSignificantBits =  64-leadingZeros; // recall binExp is  - shift count.
        } else {
            fractBits |= FRACT_HOB;
            nSignificantBits = EXP_SHIFT+1;
        }
        binExp -= DoubleConsts.EXP_BIAS;
        BinaryToASCIIBuffer buf = getBinaryToASCIIBuffer();
        buf.setSign(isNegative);
        // call the routine that actually does all the hard work.
        buf.dtoa(binExp, fractBits, nSignificantBits, isCompatibleFormat);
        return buf;
    }
867137
public AsciiSet invert() {
    final boolean[] invertMembers = new boolean[128];
    for (int i = 0; i < invertMembers.length; ++i) {
      invertMembers[i] = !members[i];
    }
    return new AsciiSet(invertMembers);
  }