{
  public static final byte[] fromBase64(String str)  {    int len = str.length();    if (len == 0)      {        throw new NumberFormatException("Empty string");      }    byte[] a = new byte[len + 1];    int i, j;    for (i = 0; i < len; i++)      {        try          {            a[i] = (byte) BASE64_CHARS.indexOf(str.charAt(i));          }        catch (ArrayIndexOutOfBoundsException x)          {            throw new NumberFormatException("Illegal character at #" + i);          }      }    i = len - 1;    j = len;    try      {        while (true)          {            a[j] = a[i];            if (--i < 0)              {                break;              }            a[j] |= (a[i] & 0x03) << 6;            j--;            a[j] = (byte) ((a[i] & 0x3C) >>> 2);            if (--i < 0)              {                break;              }            a[j] |= (a[i] & 0x0F) << 4;            j--;            a[j] = (byte) ((a[i] & 0x30) >>> 4);            if (--i < 0)              {                break;              }            a[j] |= (a[i] << 2);            j--;            a[j] = 0;            if (--i < 0)              {                break;              }          }      }    catch (Exception ignored)      {      }    try      { // ignore leading 0-bytes        while (a[j] == 0)          {            j++;          }      }    catch (Exception x)      {        return new byte[1]; // one 0-byte      }    byte[] result = new byte[len - j + 1];    System.arraycopy(a, j, result, 0, len - j + 1);    return result;  }