Java ASCII asciiQuads(String word)

Here you can find the source of asciiQuads(String word)

Description

ascii Quads

License

Open Source License

Declaration

static int[] asciiQuads(String word) 

Method Source Code

//package com.java2s;

public class Main {
    static int[] asciiQuads(String word) {
        int blen = word.length();
        int[] result = new int[(blen + 3) / 4];
        for (int i = 0; i < blen; ++i) {
            int x = word.charAt(i);

            if (++i < blen) {
                x = (x << 8) | word.charAt(i);
                if (++i < blen) {
                    x = (x << 8) | word.charAt(i);
                    if (++i < blen) {
                        x = (x << 8) | word.charAt(i);
                    }//from www. j  av a 2  s. c o m
                }
            }
            result[i / 4] = x;
        }
        return result;
    }
}

Related

  1. asciiFill2(String str, int startIdx, String fillStr)
  2. asciify(String s)
  3. asciiIdx2StrIdx(String str, int asciiIdx)
  4. asciiLength(String str)
  5. asciiPaddingR(String str, int length, String padding)
  6. asciiString(byte[] bytes, int from, int count)
  7. asciiString(String fourcc)
  8. AsciiStringToString(String content)
  9. asciiToBCD(byte[] ascii, int asc_len)