可以使用 Java 自带的 Base64 类的 decode 方法将 Base64 编码的字符串转换为 byte[] 数据。

示例代码:

import java.util.Base64;

public class Main {
    public static void main(String[] args) {
        String base64Str = 'SGVsbG8gV29ybGQh';
        byte[] bytes = Base64.getDecoder().decode(base64Str);
        System.out.println(new String(bytes));
    }
}

输出:

Hello World!

在上面的示例中,我们首先定义了一个 Base64 编码的字符串 'base64Str',然后使用 Java 自带的 Base64 类的 getDecoder 方法获取一个 Base64.Decoder 对象,然后调用该对象的 decode 方法将 Base64 编码的字符串转换为 byte[] 数据,并最终打印出字符串。

Java Base64 编码字符串转 byte[] 数组