[swexpert] 1928. Base 64 Decoder (D2, java)

728x90
반응형

다행이도 자바는 라이브러리를 제공해준다 엔코딩, 디코딩을 처음 해보는 것 같다 

 

import java.util.Base64.Decoder;
import java.util.Scanner;

public class Solution {
	
public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		sc.nextLine();
		for (int i = 0; i <t; i++) {
			String s=sc.nextLine();
			byte[] bytes=s.getBytes();
			
			Decoder decoder=java.util.Base64.getDecoder();
			byte[] decodeBytes=decoder.decode(bytes);
			
			System.out.printf("#%d %s\n",i+1,new String(decodeBytes));
			
		}
		sc.close();
	}
	
	
}
	


728x90
반응형
TAGS.

Comments