views:

14

answers:

0

Hello, I have a problem with conversion java code to action script 3. Anyone can help with code translation? Thanks.

public static short[] decmail_str_to_binary_data(String s)
{
    short[] data = new short[s.length()/2];

    for (int i = 0; i < s.length(); i += 2)
    {
        char c1 = s.charAt(i);
        char c2 = s.charAt(i + 1);

        int comb = Character.digit(c1, 16) & 0xff;
        comb <<= 4;
        comb += Character.digit(c2, 16) & 0xff;
        data[i/2] = (short)comb;
    }

    return data;
}