public static byte[] base64Decode(String encoded)
    {
        int padding = 0;

        for (int i = encoded.length() - 1; encoded.charAt(i) == '='; i--) {
            padding++;
        }

        int length = encoded.length() * 6 / 8 - padding;
        byte[] bytes = new byte[length];

        for (int i = 0, index = 0, n = encoded.length(); i < n; i += 4) {
            int word = reverseLookup[encoded.charAt(i)] << 18;
            word += reverseLookup[encoded.charAt(i + 1)] << 12;
            word += reverseLookup[encoded.charAt(i + 2)] << 6;
            word += reverseLookup[encoded.charAt(i + 3)];

            for (int j = 0; j < 3 && index + j < length; j++) {
                bytes[index + j] = (byte) (word >> (8 * (2 - j)));
            }

            index += 3;
        }

        return bytes;
    }
public static byte[] base64Decode(String encoded)
    {
        int padding = 0;

        for (int i = encoded.length() - 1; encoded.charAt(i) == '='; i--) {
            padding++;
        }

        int length = encoded.length() * 6 / 8 - padding;
        byte[] bytes = new byte[length];

        for (int i = 0, index = 0, n = encoded.length(); i < n; i += 4) {
            int word = reverseLookup[encoded.charAt(i)] << 18;
            word += reverseLookup[encoded.charAt(i + 1)] << 12;
            word += reverseLookup[encoded.charAt(i + 2)] << 6;
            word += reverseLookup[encoded.charAt(i + 3)];

            for (int j = 0; j < 3 && index + j < length; j++) {
                bytes[index + j] = (byte) (word >> (8 * (2 - j)));
            }

            index += 3;
        }

        return bytes;
    }
public static byte [ ] base64Decode ( String encoded ) { int padding = 0 ; for ( int i = encoded . length ( ) - 1 ; encoded . charAt ( i ) == ' ' ; i -- ) { padding ++ ; } int length = encoded . length ( ) * 6 / 8 - padding ; byte [ ] bytes = new byte [ length ] ; for ( int i = 0 , index = 0 , n = encoded . length ( ) ; i < n ; i += 4 ) { int word = reverseLookup [ encoded . charAt ( i ) ] << 18 ; word += reverseLookup [ encoded . charAt ( i + 1 ) ] << 12 ; word += reverseLookup [ encoded . charAt ( i + 2 ) ] << 6 ; word += reverseLookup [ encoded . charAt ( i + 3 ) ] ; for ( int j = 0 ; j < 3 && index + j < length ; j ++ ) { bytes [ index + j ] = ( byte ) ( word >> ( 8 * ( 2 - j ) ) ) ; } index += 3 ; } return bytes ; }
Decodes the specified base64 string back into its raw data.

@param encoded The base64 encoded string.
Decodes the specified base64 string back into its raw data .