static public byte[] decode(String b64Str)
    {
        // not yet tested
        StringBuffer sb = new StringBuffer();
        int len = b64Str.length();
        while ((len > 0) && (b64Str.charAt(len - 1) == Base64Pad)) { len--; }
        
        /* output buffer length */
        // XX==, XXX=, XXXX, XXXXXX==
        int b = 0, blen = (((len - 1) / 4) * 3) + ((len - 1) % 4);
        if (((len - 1) % 4) == 0) {
            // the encoded Base64 String has an invalid length
            blen++;
        }
        byte buff[] = new byte[blen]; 
        // 1=?0, 2=1, 3=2, 4=3, 5=?3, 6=4, 7=5, 8=6, 9=?6, 10=7
        
        for (int i = 0; i < len; i += 4) {
            
            /* place next 3 bytes into register */
            int              reg24  = (_indexOf(b64Str.charAt(i  )) << 18) & 0xFC0000;
            if ((i+1)<len) { reg24 |= (_indexOf(b64Str.charAt(i+1)) << 12) & 0x03F000; }
            if ((i+2)<len) { reg24 |= (_indexOf(b64Str.charAt(i+2)) <<  6) & 0x000FC0; }
            if ((i+3)<len) { reg24 |= (_indexOf(b64Str.charAt(i+3))      ) & 0x00003F; }

                             buff[b++] = (byte)((reg24 >>> 16) & 0xFF);
            if ((i+2)<len) { buff[b++] = (byte)((reg24 >>>  8) & 0xFF); }
            if ((i+3)<len) { buff[b++] = (byte)((reg24       ) & 0xFF); }

        }
        
        return buff;
        
    }