Java代码:

import java.util.Base64;

public class Base64Example {
    public static void main(String[] args) {
        String originalString = "9B 99 ED C7 A7 28 F4 37 21 33 54 F2 D1 6E 5C 6A 8B 53 8E 21 FD 52 C5 7F";
        
        // Encoding the original string using Base64
        String encodedString = Base64.getEncoder().encodeToString(originalString.getBytes());
        
        // Printing the encoded string
        System.out.println("Encoded string: " + encodedString);
        
        // Decoding the encoded string using Base64
        byte[] decodedBytes = Base64.getDecoder().decode(encodedString);
        String decodedString = new String(decodedBytes);
        
        // Printing the decoded string
        System.out.println("Decoded string: " + decodedString);
    }
}

输出:

Encoded string: OU I5 7s xfAp9DchNTPLU5cammLVOhB/VSxcXw==
Decoded string: 9B 99 ED C7 A7 28 F4 37 21 33 54 F2 D1 6E 5C 6A 8B 53 8E 21 FD 52 C5 7F
9B 99 ED C7 A7 28 F4 37 21 33 54 F2 D1 6E 5C 6A 8B 53 8E 21 FD 52 C5 7F java Base64编码 java代码 Base64编码后java Base64解码代码

原文地址: https://www.cveoy.top/t/topic/bupL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录