decode Base64 string via java.util.Base64 - Java java.lang

Java examples for java.lang:String Base64

Description

decode Base64 string via java.util.Base64

Demo Code


//package com.java2s;

import java.nio.charset.Charset;
import java.util.Base64;

public class Main {
    public static void main(String[] argv) throws Exception {
        String encodedValue = "java2s.com";
        System.out.println(java.util.Arrays.toString(decode(encodedValue)));
    }// ww  w. ja  v  a 2 s.co  m

    public static String[] decode(String encodedValue) {
        String decodedValue = new String(Base64.getDecoder().decode(
                encodedValue), Charset.forName("UTF-8"));
        return decodedValue.split(":");
    }
}

Related Tutorials