microsoft-azure-storage/src/com/microsoft/azure/storage/core/Base64.java
public static boolean validateIsBase64String(final String data) {

        if (data == null || data.length() % 4 != 0) {
            return false;
        }

        for (int m = 0; m < data.length(); m++) {
            final byte charByte = (byte) data.charAt(m);

            // pad char detected
            if (DECODE_64[charByte] == -2) {
                if (m < data.length() - 2) {
                    return false;
                }
                else if (m == data.length() - 2 && DECODE_64[(byte) data.charAt(m + 1)] != -2) {
                    return false;
                }
            }

            if (charByte < 0 || DECODE_64[charByte] == -1) {
                return false;
            }
        }

        return true;
    }
public static boolean validateIsBase64String(final String data) {

        if (data == null || data.length() % 4 != 0) {
            return false;
        }

        for (int m = 0; m < data.length(); m++) {
            final byte charByte = (byte) data.charAt(m);

            // pad char detected
            if (DECODE_64[charByte] == -2) {
                if (m < data.length() - 2) {
                    return false;
                }
                else if (m == data.length() - 2 && DECODE_64[(byte) data.charAt(m + 1)] != -2) {
                    return false;
                }
            }

            if (charByte < 0 || DECODE_64[charByte] == -1) {
                return false;
            }
        }

        return true;
    }
Determines whether the given string contains only Base64 characters.

@param data
the string, as a <code>String</code> object, to validate
@return <code>true</code> if <code>data</code> is a valid Base64 string, otherwise <code>false</code>